question on padstring
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 31
- Joined: Tue May 24, 2011 12:16 am
alwasy better to go to datastage help. Press F1 key and go to DS help, is the best repositery to understand transformation function.
PadString(%string%,%padstring%,%padlength%)
PadString returns the string padded with the optional pad character and optional length
you need to provide the char to pad and length till which you want to pad.
hope it will help.
PadString(%string%,%padstring%,%padlength%)
PadString returns the string padded with the optional pad character and optional length
you need to provide the char to pad and length till which you want to pad.
hope it will help.
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
-
- Participant
- Posts: 31
- Joined: Tue May 24, 2011 12:16 am
PadString("Pratik"," ",5)
In this example, I am trying to pad the string (Pratik) with five spaces. So, the output will be Pratik .
The problem with PadString() is that you can only pad a string to the right but I don't know whether it is possible to pad a string to the left of it also or not?
Yes, we can do that thing by doing some other operations but I want to whether we can do that directly with the help of PadString()?
In this example, I am trying to pad the string (Pratik) with five spaces. So, the output will be Pratik .
The problem with PadString() is that you can only pad a string to the right but I don't know whether it is possible to pad a string to the left of it also or not?
Yes, we can do that thing by doing some other operations but I want to whether we can do that directly with the help of PadString()?
Thanks,
Pratik.
Pratik.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Why necessarily with PadString() ? There is an easy way to left-pad with spaces. Create a string of that many spaces, concatenate the data, then extract the rightmost that many characters from the result.
Code: Select all
Right(Space(12):InLink.TheString),12)
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.