Newbies jkinch Posted August 23, 2007 Newbies Posted August 23, 2007 I have a situation where i need to count the number of leading spaces in a text field. Does anyone have thoughts on how to do this. Please keep in mind that spaces could be anywhere in the text, including trailing. I only wan to count the leading spaces. Thanks
Fenton Posted August 23, 2007 Posted August 23, 2007 This seems to work, if your first character other than a space is an letter or digit. It considers punctuation (incl. #@-_., etc.) to be the same as a space however. Let ( word1 = LeftWords ( Text_; 1 ); Position ( Text_ ; word1 ; 1 ; 1 ) - 1 )
Raybaudi Posted August 23, 2007 Posted August 23, 2007 Hi you can try this calc too... Length ( GetValue ( Substitute ( yourField ; Trim ( yourField ) ; ¶ ) ; 1 ) ) This counts the leading spaces whatever char is after them. ( and counts the spaces even if there aren't chars ! )
Raybaudi Posted August 23, 2007 Posted August 23, 2007 ... and, to count the trailing spaces: Length ( GetValue ( Substitute ( yourField ; Trim ( yourField ) ; ¶ ) ; 2 ) )
Recommended Posts
This topic is 6362 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now