diff options
author | rbuj <robert.buj@gmail.com> | 2014-07-31 15:52:37 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-08-01 08:41:14 +0000 |
commit | 0a6e0840526175de78a84b95871131664f634744 (patch) | |
tree | d8deeba349f60c4d14f2f1bbafb7d5744266bff2 /xmerge | |
parent | 981e2dcd44d3b33b5af791645f77b6c7f2da831c (diff) |
xmerge: Use J2SE 5.0 String.{replace|contains}
Replace "String.indexOf(String str)!=-1" with String.contains(String str)
Use J2SE 5.0 String String.replace(CharSequence target, CharSequence replacement).
Format code in needsMask function.
Change-Id: I787a61c4c090f95fb3862390cc1198f7209163a3
Reviewed-on: https://gerrit.libreoffice.org/10659
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/bridge/java/XMergeBridge.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java index 87b07a6ecbc4..347c239c5c02 100644 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ b/xmerge/source/bridge/java/XMergeBridge.java @@ -301,20 +301,19 @@ public class XMergeBridge { } public String needsMask(String origString){ - if (origString.indexOf("&")!=-1){ - origString=replace(origString,"&","&"); + if (origString.contains("&")) { + origString = origString.replace("&","&"); } - if (origString.indexOf("\"")!=-1){ - origString=replace(origString,"\"","""); + if (origString.contains("\"")) { + origString = origString.replace("\"","""); } - if (origString.indexOf("<")!=-1){ - origString=replace(origString,"<","<"); + if (origString.contains("<")) { + origString = origString.replace("<","<"); } - if (origString.indexOf(">")!=-1){ - origString=replace(origString,">",">"); + if (origString.contains(">")) { + origString = origString.replace(">",">"); } return origString; - } @@ -545,7 +544,7 @@ public class XMergeBridge { private String getPath(URI uri){ String path = uri.getPath(); String opSys=System.getProperty("os.name"); - if(opSys.indexOf("Windows")!=-1){ + if(opSys.contains("Windows")){ path= path.replace('/','\\'); path = path.substring(1); } |