package com.xpagedeveloper;
public class CString{
public static String RightBack(String Source,String Find){
int pos=Source.lastIndexOf(Find);
if(pos>0){
if(pos+Find.length()==Source.length()){
return "";
}else{
return Source.substring(pos+Find.length());
}
}else{
return Source;
}
}
public static String LeftBack(String Source,String Find){
int pos=Source.lastIndexOf(Find);
if(pos>0){
return Source.substring(0,pos);
}else{
return Source;
}
}
public static String Right(String Source,String Find){
int pos=Source.indexOf(Find);
if(pos>0){
return Source.substring(pos+Find.length());
}else{
return Source;
}
}
public static String Left(String Source,String Find){
int pos=Source.indexOf(Find);
if(pos>0){
return Source.substring(0,pos);
}else{
return Source;
}
}
public static String ReplaceSubstring(String Source,String Find,String ReplaceWith){
if(Find.equals(".")){
Find="\\"+Find;
}
return Source.replaceAll(Find,ReplaceWith);
}
}