π This blog post was created with AI assistance to help developers understand Uniface 10.4 better.
Hey there, developers! π Today we're diving into one of Uniface 10.4's handy utility commands: stripattributes. If you're working with text formatting in Uniface applications, this little gem can be a real lifesaver! π
π€ What is stripattributes?
The stripattributes
command is like a text cleaner π§Ή. It takes formatted text (with things like bold, italic, and underlined characters) and removes all that formatting, giving you clean, plain text.
Technical Definition: stripattributes removes character attributes (bold, italic, underline), frames, and rulers from a source and puts the clean result in a target location.
π Basic Syntax
The syntax is super simple:
stripattributes Source, Target
Where:
- Source: The original text with formatting (can be a field, variable, or function)
- Target: Where you want the clean text to go
π― Practical Example
Let's say you have a field called MYFIELD containing formatted text, and you want to display it cleanly in an EDITBOX:
MYFIELD = "aaabbb" ; This might contain bold/italic formatting stripattributes MYFIELD, EDITBOX ; EDITBOX now contains clean "aaabbb"
After running this command, EDITBOX will contain the same text but without any formatting! β¨
π Understanding Return Values
The command tells you what it cleaned up through the $status
variable:
- 0: Nothing was stripped (text was already clean) π
- 1: Character attributes were removed (bold, italic, underline) π¨
- 4: Frames were stripped πΌοΈ
- 8: Rulers were removed π
Pro Tip: These values can be combined! If $status returns 5 (1+4), it means both attributes and frames were stripped. π§
β‘ When to Use stripattributes
This command is perfect when you need to:
- Clean up user input before saving to databases πΎ
- Prepare formatted text for plain text displays πΊ
- Export data to systems that don't support formatting π€
- Create consistent, clean text for reports π
π¨ Key Terms Explained
- Character Attributes: Text formatting like bold, italic, and underline
- Frames: Visual borders or containers around text elements
- Rulers: Measurement guides used in text layout
- ProcScript: Uniface's programming language for application logic
β οΈ Important Notes
Remember that unknown characters in the target character set won't be stripped - this is different from older Uniface versions that would remove them completely. This helps preserve international characters! π
The stripattributes command works in all Uniface component types, making it super versatile for your applications. π οΈ
π― Conclusion
The stripattributes command might seem simple, but it's incredibly useful for maintaining clean, consistent text in your Uniface applications. Whether you're processing user input or preparing data for export, this little command can save you lots of headaches! πͺ
Happy coding, and may your text always be clean! β¨π
Top comments (0)