Softanza
StartFrançais
Softanza
Research · narration

Simplifying Orientation in String Removal with Softanza

In text manipulation, removing a substring from the left or right of a string is a common task, but it can quickly become tricky when handling languages with different orientations, such as Arabic. Softanza addresses this challenge by offering both specific and generalized solutions for managing string content seamlessly.

by Mansour Ayouni · in the repository since 2024-12-07 · feature essay · area String

Softanza Lists-in-Strings, by Microsoft Image Create AI
Softanza Lists-in-Strings, by Microsoft Image Create AI

Softanza Lists-in-Strings, by Microsoft Image Create AI


Traditional Approaches: Left and Right Removal

Softanza provides two straightforward functions to remove substrings:

  1. RemoveFromLeft(): Removes a substring from the left side of the string.
  2. RemoveFromRight(): Removes a substring from the right side of the string.

For example:

Haro
load "stzlib.ring"

o1 = new stzString("let's say welcome to everyone!")
o1.RemoveFromLeft("let's say ")
? o1.Content()
#--> welcome to everyone!

run on 2026-10-08 20:45 at commit 4a184e6f0: kept its promise

This works well for languages like English, where text flows left to right. However, things get less intuitive with right-to-left (RTL) languages like Arabic.

The RTL Challenge: Left and Right Confusion

Consider an Arabic sentence:

Haro
o1 = new stzString("هذه الكلمات الّتي سوف تبقى")
? o1.NRightCharsXT(4)
#--> "هذه "

illustration

To remove the substring "هذه " (which appears visually at the start), you would use RemoveFromRight() instead of RemoveFromLeft(). Why? Because for an RTL string, ""right" corresponds to the start of the text, and "left" corresponds to the end.

Haro
o1.RemoveFromRight("هذه ")
? o1.Content() #--> "الكلمات الّتي سوف تبقى"

run on 2026-10-08 20:45 at commit 4a184e6f0: kept its promise

This reversal in directionality can cause confusion, especially for developers working with multilingual systems.

NOTE: The XT() suffix, when appended to a Softanza function, signifies an eXTended outcome of the basic feature in question. For example, in the case of o1.NRightCharsXT() shown above, the suffix forces the output to be a string rather than a list of characters. In other words: without XT, calling o1.NRightChars() produces the list [ "ه", "ذ", "ه", " " ] instead of the string "هذه ".

A Semantic Solution: Start and End Removal

To eliminate orientation-based complications, Softanza introduces two semantic alternatives:

  1. RemoveFromStart(): Removes a substring from the logical start of the string, regardless of the text's orientation.
  2. RemoveFromEnd(): Removes a substring from the logical end.

Using these, the same task becomes simpler and more intuitive:

Haro
o1 = new stzString("let's say welcome to everyone!")
o1.RemoveFromStart("let's say ")
? o1.Content()
#--> welcome to everyone!

run on 2026-10-08 20:45 at commit 4a184e6f0: kept its promise

And for Arabic text:

Haro
o1 = new stzString("هذه الكلمات الّتي سوف تبقى")
o1.RemoveFromStart("هذه ")
? o1.Content() #--> "الكلمات الّتي سوف تبقى"

run on 2026-10-08 20:45 at commit 4a184e6f0: kept its promise

Why It Matters

The RemoveFromStart() and RemoveFromEnd() functions embody Softanza's commitment to semantic programming—designing functions that align with human logic rather than the technicalities of text representation.

Whether you're working with left-to-right English text or right-to-left Arabic, these functions provide:

  • Clarity: No need to second-guess the directionality of your text.
  • Consistency: The same code works for all orientations, reducing bugs in multilingual applications.
  • Ease of Use: Developers can focus on their logic without worrying about the underlying mechanics of text rendering.

Conclusion

Softanza simplifies string manipulation for multilingual and bidirectional text environments, ensuring developers can write clean, intuitive, and error-free code. The semantic approach of RemoveFromStart() and RemoveFromEnd() highlights the library's attention to detail and user-centered design.

Cite

Mansour Ayouni. "Simplifying Orientation in String Removal with Softanza". Softanza narrations, 2024. https://mayouni.github.io/stzsite/en/narrations/stzstring-removefrom-narration.html

Run in Haro's name on 2026-10-08 20:45 inside the library at commit 4a184e6f0, block after block in one process: 4 of 5 blocks kept their promise; the others are illustrations. The code of the articles is Haro code. Where an article was written before the language took its present name, the name was changed and nothing else. Genre, area and series read from the file's name, the year from its first commit: derived, until the article carries its own header. The file on GitHub(opens in a new tab)