I want to change every occurance of & to and
The CONVERTSTR function does not let me do that since & and and have different number of characters..
Does anyone know of a way of doing this??
I would probably write a concatenation function. You get the position of the &, and then you cut whatever is in front of it, do "+ 'and' +" and then whatever is after it.
Heh Some day or later, everbody needs to write a decent string manipulation codeunit in navision - reverse, replace, ltrim, rtrim, alltrim... It's all about for cycles and char variables.
Do It Yourself is they key. Standard code might work - your code surely works.
I have quite a few codeunits which can be imported to any database as they don't depend on any other object.
Stuff like String Handling, Array Handling, Excel, Word and Outlook Automation, File Manipulation, Date and Time utilities, etc.
Well, maybe you can't just import a few of them.
Mostly the Microsoft Office stuff depends on Office being installed, of course. :roll:
hi everybody!
I'm a navision newbie so please don't shoot me!!! :P
I searched for those "archives" in all mibuso.com, but I didn't find them, could you please give me a link or something similar?
thanks a lot!
I actually meant my archives... it's stuff I collected over the years and which I have lying around in databases and FOB's.
So, no link which I can give you. sorry.
ah ok, I supposed it was like this...
so, I disturb you a little bit again...could you post some string manipulation function or mail me a little fob with these functions?
I'm looking for some "stupid" but very useful functions like trim, reverse and similar, but I haven't idea of how to create them...
Well, string manipulation functions are really not that hard.
When you are in the C/AL editor, use the Symbol Menu (F5) to see all the existing string functions.
You will find them in SYSTEM, String. With these you should be able to tackle most string-related problems.
For example, in order to trim a string you can use the DELCHR function:
DELCHR(String,'<>') will delete spaces at the beginning and end of the string.
If you want to replace a substring with new subtring which contains the same charachters, the ReplaceString function by nelson will cycling over the loop. So you can use the following function:
LOCAL ReplaceString(String : Text;FindWhat : Text;ReplaceWith : Text) NewString : Text
FindPos := STRPOS(String,FindWhat);
WHILE FindPos > 0 DO BEGIN
NewString += DELSTR(String,FindPos) + ReplaceWith;
String := COPYSTR(String,FindPos + STRLEN(FindWhat));
FindPos := STRPOS(String,FindWhat);
END;
NewString += String;
For example, if you want escape characters in XML you can use:
ReplaceString(XMLBody,'"','\"');
Input:
<FullName>Публичное акционерное общество "Рога и Копыта"</FullName>
Output:
<FullName>Публичное акционерное общество \"Рога и Копыта\"</FullName>
Comments
RIS Plus, LLC
It's from the archives...:
[edit]
Oh, and then you just use the function as: The return will be:
Do It Yourself is they key. Standard code might work - your code surely works.
RIS Plus, LLC
Stuff like String Handling, Array Handling, Excel, Word and Outlook Automation, File Manipulation, Date and Time utilities, etc.
Well, maybe you can't just import a few of them.
Mostly the Microsoft Office stuff depends on Office being installed, of course. :roll:
I'm a navision newbie so please don't shoot me!!! :P
I searched for those "archives" in all mibuso.com, but I didn't find them, could you please give me a link or something similar?
thanks a lot!
P
So, no link which I can give you. sorry.
so, I disturb you a little bit again...could you post some string manipulation function or mail me a little fob with these functions?
I'm looking for some "stupid" but very useful functions like trim, reverse and similar, but I haven't idea of how to create them...
thanks for answering!
P.
When you are in the C/AL editor, use the Symbol Menu (F5) to see all the existing string functions.
You will find them in SYSTEM, String. With these you should be able to tackle most string-related problems.
For example, in order to trim a string you can use the DELCHR function:
DELCHR(String,'<>') will delete spaces at the beginning and end of the string.
If you want to replace a substring with new subtring which contains the same charachters, the ReplaceString function by nelson will cycling over the loop. So you can use the following function:
For example, if you want escape characters in XML you can use:
Input:
<FullName>Публичное акционерное общество "Рога и Копыта"</FullName>
Output:
<FullName>Публичное акционерное общество \"Рога и Копыта\"</FullName>
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
If yes then please verify!!
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/