Trim

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
allthenames
Newbie
Posts: 18
Joined: Wed Aug 18, 2010 5:51 pm

Trim

Post by allthenames » Thu Jun 28, 2012 12:40 am

Is there any way to trim or limit a variable to 40 characters? I am imputing data into excel and for my purposes the data can only be 40 characters long.

With the Trim> command?

Thanks for your help
-Ben

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jun 28, 2012 5:30 am

MidStr> rather than Trim>

Code: Select all

Let>var=whatever alphanumeric string you want the variable to be 
Midstr>var,1,40,var

mdl>var

allthenames
Newbie
Posts: 18
Joined: Wed Aug 18, 2010 5:51 pm

Post by allthenames » Fri Jul 06, 2012 3:10 am

perfect thanks
-Ben

allthenames
Newbie
Posts: 18
Joined: Wed Aug 18, 2010 5:51 pm

Java?

Post by allthenames » Sat Aug 25, 2012 4:13 am

Midstr>var,1,40,var


Any way to do this in Java?
-Ben

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Aug 25, 2012 5:17 pm

We don't do Java here, but Google is your friend :wink:

allthenames
Newbie
Posts: 18
Joined: Wed Aug 18, 2010 5:51 pm

exception

Post by allthenames » Fri Sep 28, 2012 2:51 am

How would I go about adding an exception here? For the times when the variable is less than 40 characters?

Thanks for your help/patience
-Ben

olllllliii
Pro Scripter
Posts: 60
Joined: Tue Dec 22, 2009 9:51 am
Location: Mannheim ( Germany )
Contact:

if >40 or <40

Post by olllllliii » Fri Sep 28, 2012 1:10 pm

Let>var=whatever alphanumeric string you want the variable to be
Length>var,varlength

IF>varlength>40
// if above 40 cut to 40
Midstr>var,1,40,var
ELSE
Midstr>var,1,10,var
// if less 40
ENDIF
mdl>var

Kind regards
Oli
Oliver Hilger Mannheim
alias Olllllliii

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts