I realize this is probably a user error issue. I had massive help writing this calculation.
What I want: The data returned with no leading space
What I get: a space in front of the data
I'm working on: FMP 14
I noticed this when I combined two substitutes there was an unwanted space. I created a new field and utilized the Length function. I did some other work, and I notice that the space is in front of the data. How can I alter the below calculation to remove that space? I have 5 ( I think) of these calculations with different substrings. Data length can be 1 character, or multiple words with spaces. Is there a way to show "hidden character" like in MS Word?
I thought the part in bold/red would get rid of the spaces... but I think I am interpreting it wrong. The rest of the calc is performing as desired.
~string = Space ;
~substring = "Building" ;
~fail = "TBD"
// -- core function, this is the actual function
// In order to start with simpler test, we first test the case where the substring is not contained in the script -> throw a failed test string (TBD or other) if true
PatternCount ( ~string ; ~substring ) = 0 ; // This means the string does not contain the substring
TextStyleAdd ( ~fail ; HighlightYellow ) ;
// Else, we proceed to extrating alla the characters after our Substring
// using FM native function, we determine the substring position in the string, the length of the string and then extract all characters after Position + Length
~lenString = Length ( ~string ) ;
~lenSubstring = Length ( ~substring ) ;
~posSubstring = Position ( ~string ; ~substring ; 1 ; 1 ) ;
~return = Middle ( ~string ; ~posSubstring + ~lenSubstring ; ~lenString )
// At the end, we trim the result, so we get rid of any unwanted spaces
GetValue ( Substitute ( ~return ; "-" ; ¶ ) ; 1 ) )
// -- end of core function
) // closing first let statement