
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replace characters with Ascii numbers in a string
Hi,
The below code helps in replacing characters with ASCII codes in a string in Load script
For example
ABC is converted to 656667- since ASCII code of A is 65, B is 66 and C is 67.
CharMap:
Mapping LOAD
Chr(RecNo() - 1) AS Char,
RecNo() - 1 AS Asciicode
AutoGenerate 256;
Data:
LOAD
Text,
MapSubString('CharMap', Text) as formattedText
FROM DataSource;
Hope this helps.
Regards,
Jagan.


- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
You life saver, works perfectly.
Thank you


- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hey,
Thanks.Worked perfectly for a certain issue.


- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks,
Have tweaked this slightly as I need the Ascii for one character only.
Once the Ascii code is identified, it is then easy to replace
//Code to find the ascii code of a single char
CharMap:
Mapping
LOAD
Chr(RecNo() - 1) AS Char,
RecNo() - 1 AS Asciicode
AutoGenerate 256;
Data:
LOAD
Text,
MapSubString('CharMap', Text) as formattedText
;
LOAD
mid(Text,9,1) as Text
Resident Table;
// code then added to script to replace
Replace(text, chr(10), ' ') as text