Jump to content
Server Maintenance This Week. ×

Removing leading spaces in a Calculation field


This topic is 1183 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi everyone

I have a Calculation Field called "extract_field_1"
which extracts the data of "field_1" (ie, anything between "field_1:" and "field_2:"
in a text-field called INPUT
which looks like this:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Let ( [
lineStart = Position ( INPUT ; "¶field_1:" ; 1 ; 1 ) ;
start = lineStart + Length("¶field_1:");
end = Position ( INPUT ; "¶field_2:" ; start ; 1 )
] ;
Middle ( INPUT ; start ; end - start )
)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This works nicely (many thanks to comment for this).

However, sometimes the result will start with one or more "space" characters and sometimes not. It depends on what my user has typed into INPUT!!!

Can anyone recommend how to add to this Calculation so that:
-- any leading "spaces" are removed from the beginning of the result.

Thanks in anticipation.       Philip

Link to comment
Share on other sites

Thanks comment.

Of course Trim() worked perfectly.

Sorry about the large font size of my original message. I had to increase it so my poor elderly eyes could read my code on screen, and then I forgot to change it back down again afterwards.

Sorry, and Thanks. 

Stay Safe!

Link to comment
Share on other sites

This topic is 1183 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.