Select part of string

sharon95
Member Posts: 183
I have to save into a variable anly a part of a string,
i.e.: String: "name:Mark"
myVar: "Mark"
i.e.: String: "name:Mark"
myVar: "Mark"
0
Comments
-
https://msdn.microsoft.com/en-us/library/dd338944.aspx
https://msdn.microsoft.com/en-us/library/dd355417.aspx
Look at the links.
myVar := COPYSTR('name:Mark',STRPOS('name:Mark','M'))Austrian NAV/BC Dev0 -
is prefix fixed always? (name:)?
does your string has " " also?0 -
If it is fixed then try
myVar := COPYSTR(String,6,MAXSTRLEN(String)-6));0 -
https://msdn.microsoft.com/en-us/library/dd338944.aspx
https://msdn.microsoft.com/en-us/library/dd355417.aspx
Look at the links.
myVar := COPYSTR('name:Mark',STRPOS('name:Mark','M'))
But, in another case I have to start from the character after ":"... any tip?0 -
mohana_cse06 wrote: »If it is fixed then try
myVar := COPYSTR(String,6,MAXSTRLEN(String)-6));
It's not fixed, I have to select the character after ":"0 -
only one character after : or all characters after : ?
did you above code?0 -
all character after :0
-
then the above code should work. try and let me know if you have any issues0
-
but it's not fixed.. I can have xxxxxxx:x, x:xxxxxxxxxxxxxx, x:x, .....0
-
ok.. got it. try this.
myVar := COPYSTR(String,STRPOS(String,':')+1,MAXSTRLEN(String)-STRPOS(String,':')));1 -
mohana_cse06 wrote: »ok.. got it. try this.
myVar := COPYSTR(String,STRPOS(String,':')+1,MAXSTRLEN(String)-STRPOS(String,':')));
It worked with myVar := COPYSTR(String,STRPOS(String,':')+1
It didn't work with myVar := COPYSTR(String,STRPOS(String,':')+1,MAXSTRLEN(String)-STRPOS(String,':')));
Thank youu!!!0 -
it should work with that too.
in which case it didn't work?0 -
mohana_cse06 wrote: »it should work with that too.
in which case it didn't work?
all cases, it prints ":blabla"0 -
that's not true.
you must have written without +1.
It will work.0 -
mohana_cse06 wrote: »that's not true.
you must have written without +1.
It will work.
ok, thanks! sorry but I can't see the "Did this answer the question? Yes · No" so I can't choose your answer... however I clicked the "like".. thank you @mohana_cse06 !0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions