Control character or Unprintable character in string
Moderators: chulett, rschirm, roy
Control character or Unprintable character in string
Hi,
I want to check whether the string contain control character /Unprintable character in it.
How do i check in the transformer stage .
Is there any function is there to check the same??
Can i check by their Ascii values ??? But how in DS.
Regards
~Nirmal
I want to check whether the string contain control character /Unprintable character in it.
How do i check in the transformer stage .
Is there any function is there to check the same??
Can i check by their Ascii values ??? But how in DS.
Regards
~Nirmal
Nirmal Sharma
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Prefer Seq() function. Seq() returns the ASCII code value associated with a character.
If you have NLS enabled and are using multi-byte encoding, prefer UniSeq() to Seq(). UniSeq() returns the Unicode code value associated with a character. If you have a single-byte character set, UniSeq() returns the same result as Seq().
If you have NLS enabled and are using multi-byte encoding, prefer UniSeq() to Seq(). UniSeq() returns the Unicode code value associated with a character. If you have a single-byte character set, UniSeq() returns the same result as Seq().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 193
- Joined: Tue Sep 05, 2006 8:01 pm
- Location: Australia
Re: Control character or Unprintable character in string
You can use the "od" command outside of DS; but that's in Unix unfortunately. You could do this before you run the job meaning run the script to check and cleanse the file prior.sharma wrote:Hi,
I want to check whether the string contain control character /Unprintable character in it.
How do i check in the transformer stage .
Is there any function is there to check the same??
Can i check by their Ascii values ??? But how in DS.
Regards
~Nirmal
I believe the others have chipped in on doing it in DS ; just offering an alternative.
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Use this logic in your parallel routine:
Ref THIS post also.
Ref THIS post also.
Code: Select all
#define NP_RANGE_START 32
#define NP_RANGE_END 127
bool IsCharNP(char InCharToCheck )
{
bool IsNotPrintable = false;
if( (InCharToCheck > NP_RANGE_START ) && ( InCharToCheck < NP_RANGE_END ))
{
IsNotPrintable = false;
}
else
{
IsNotPrintable = true;
}
return IsNotPrintable;
}
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
OP asked for it. Specifically!
sharma wrote:whatever string i am using should have ASCII characters between 32 and 127.If any of the character is outside this range,it should reject that string.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>