on 03-11-2008 4:31 PM
Hi friends,
I am using Binary Cache method to download to excel. The problem is that there are certain fields in the back end R/3 that has special characters in it eg : & * £ # etc.
As a result, the download is not working for these rows. Please can any of you tell me how to get rid of this. As an example let's say I wan to replace the "&" with "and".
Please help.
Thank You.
Avik
Hi Avik,
Just try it.
String Str = "Hello & World & How r You?";(Take the Context attribute Value)
String newStr = Str.replaceAll("&","And");
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks guys..... It Rocks....!!!!!
I used the replaceAll() method. Saves a lot of time and effort in Coding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
this the updated one,
public void CheckMethod( )
{
//@@begin CheckMethod()
test = wdContext.currentTestStringConversionElement().getInput();
n=test.length();
if(n!=0)
{
for(i=1;i<=n;i++)
{
c = test.charAt(i-1);
if (c=='&')
{
break;
}
}
subtest = Character.toString(c) ;
sub2= " and ";
// replaces string "&" with string "and"
test1 = test.replaceAll(subtest,sub2);
wdContext.currentTestStringConversionElement().setOutput(test1);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Hope you find tgis of some help !!
public void ReplaceMethod( )
{
//@@begin ReplaceMethod()
// get the string value of the cell (for you from the table cell, for eg, Pinki & Rakesh)
test = wdContext.currentTestStringConversionElement().getInput();
// calculate the total length of the String
n=test.length ();
if(n!=0)
{
for(i=1;i<=n;i++)
{
// catching each character from the String
c = test.charAt (i-1);
// checking if any character within the String (eg, Pinki & Rakesh) is &
if (c=='&')
{
wdContext.currentTestStringConversionElement().setOutput(Character.toString(c));
no=i;
break;
}
}
String val = Integer.toString(no);
//wdContext.currentTestStringConversionElement().setNo(val);
// breaking the String and adding and in place of &
sub1= test.substring(0,i-1);
sub2= " and ";
sub3= test.substring(i,n);
//Concatenating the String
test1 = sub1sub2sub3;
//Printing the String
wdContext.currentTestStringConversionElement().setOutput(test1);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.