cancel
Showing results for 
Search instead for 
Did you mean: 

Fill "0" in blanks

Former Member
0 Kudos

Hi

I got flat file with spaces, I used content conversion to transform this file into XML with fieldlenghts

I need to replace every sapce in the number "0"

any Ideas how to do it ?

thx,Shai

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Shai,

easy with XSL function translate()

<xsl:value-of select="translate(.,' ','0')"/>

Regards,

Udo

Former Member
0 Kudos

Hi Udo

where can I use it ?

In user defined function ? In XSLT Mapping ?

In content conversion?

If u have relvant weblogs it would help

thx,Shai

udo_martens
Active Contributor
0 Kudos

Hi Shai,

in a XSLT mapping. Nearly the same functions are avaiable for ABAP, Java or grafical mapping. Your choice.

Regards,

Udo

former_member206604
Active Contributor
0 Kudos

Hi,

You can use this is UDF

int intDif, i;
String strDiff = new String();

intDif = <b>10</b> - Par_Input.length();

if(intDif > 0)
{

strDiff = "0";

for(i=1; i<intDif; i++)
{
 strDiff = strDiff.concat("0");

}

strDiff = strDiff.concat(Par_Input);

return strDiff;
}
else
{
return Par_Input;
}

This will add 10 leading zeros... You can change it accordingly. Also check if there is some space you are eppecting you can trim the sting.

Thanks,

Prakash

Former Member
0 Kudos

Can you not just use the standard FormatNum function?

Use that function and put 00000 in the box, and it will format the number 5 to 00005, for example.

Answers (1)

Answers (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Shai,

Can you elaborate a further with the source data and the format needed.

Regards,

Bhavesh