Extract substring by separators

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Sep 27, 2011
Company:

Hello, colleagues!
I have a problem with date separation. I need to extract the day of month from a string like that 7/6/2012. The problem is that sometimes month and day is of 2 digits and sometimes is of 1. Is there any standard function to split a string by a separator?

 
#2
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Apr 2, 2012
Company: BizzSimple.com

Hi!
Try something like this:

Code
DateStr = "7/6/2012"
Str1 = Mid(DateStr, Find(DateStr, "/") + 1);
Day = Mid(Str1, 1, Find(Str1, "/") - 1);

 
#3
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Sep 27, 2011
Company:

Good, good, good, thanks!

 
#4
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Apr 17, 2012
Company: Zoi TechCon GmbH

Hello!
I like more this way:

Code
   DateStr = "7/6/2012";
   DateStr = StrReplace(DateStr,"/",Chars.LF);
   Day     = StrGetLine(DateStr,1);
   Month   = StrGetLine(DateStr,2);
   Year    = StrGetLine(DateStr,3);

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.