CONVERTSTR with variable length strings

juanborras
Member Posts: 35
Hi there!
DOes anybody how to make a string substitution like in CONVERTSTR but using different length strings?
Thanks
Juan
DOes anybody how to make a string substitution like in CONVERTSTR but using different length strings?
Thanks
Juan
0
Comments
-
not on top of my head...but u can split the sentence into words and save them in an array, replace the word you want to and concatenate the words back into a sentence.LR0
-
Ok, I see what you say... let me try
Thanks0 -
This is what you are probably looking for..
PROCEDURE TextReplace@1000000005(ltInput@1000000002 : Text[1024];ltWhat@1000000001 : Text[1024];ltWith@1000000000 : Text[1024]) ltOutput : Text[1024]; VAR liInputLen@1000000005 : Integer; liWhatLen@1000000004 : Integer; liFindFirst@1000000003 : Integer; BEGIN // TextReplace function finds all ocurences of 'ltWhat' in string 'ltInput' and replaces them with 'ltWith'. // Function returns 'ltOutput'. liInputLen := STRLEN(ltInput); liWhatLen := STRLEN(ltWhat); // check, if ltInput and ltWhat are not empty strings IF (liInputLen > 0) AND (liWhatLen > 0) THEN BEGIN liFindFirst := STRPOS(ltInput, ltWhat); WHILE (liFindFirst > 0) DO BEGIN ltOutput := ltOutput + COPYSTR(ltInput, 1, liFindFirst - 1); ltOutput := ltOutput + ltWith; ltInput := DELSTR(ltInput,1,liFindFirst + liWhatLen - 1); liFindFirst := STRPOS(ltInput, ltWhat); END; ltOutput := ltOutput + ltInput; END ELSE BEGIN ltOutput := ltInput; END; END;
®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Hi!
yes! that's what I'm looking for, thanks a lot!
Juan0 -
Hey all!
i need some help, i hope someone will help me.
i want to convert date to string, in xml port. my data type is text but it takes date.
there is error : "text := date"
and i want to convert date to text.
is it possible?
tnx all!bye my work, bye navision0 -
To convert Date to Text u can use:
TextVariable := format(dateVariable);
To convert a regular Date Expression from Text to date you can use evaluateevaluate(dateVariable,TextVariable);
RegardsDo you make it right, it works too!0 -
WOW, thanks!bye my work, bye navision0
-
Please and welcomeDo you make it right, it works too!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