Concat, Replace and Trim Strings in Java

Manikanth Mani
Updated on 26-Feb-2020 06:27:31

2K+ Views

The concat() method of the String class appends one String to the end of another. The method returns a String with the value of the String passed into the method, appended to the end of the String, used to invoke this method.Examplepublic class Test {    public static void main(String args[]) {       String s = "Strings are immutable";       s = s.concat(" all the time");       System.out.println(s);    } }OutputStrings are immutable all the timeThis replace() method of the String class returns a new string resulting from replacing all occurrences of oldChar in ... Read More

String Compare by Operator in Java

V Jyothi
Updated on 26-Feb-2020 06:23:02

162 Views

You can compare two strings using == operator. But, it compares references of the given variables, not values.ExampleLive Demopublic class Sample {    public static void main(String args[]){       String str1 = "hello";       String str2 = "hello";       System.out.println(str1 == str2);    } }Outputtrue

Java String equals Versus

Sai Nath
Updated on 26-Feb-2020 06:22:25

293 Views

The equals() method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.ExampleLive Demopublic class Sample {    public static void main(String []args) {       String s1 = "tutorialspoint";       String s2 = "tutorialspoint";       String s3 = new String ("Tutorials Point");       System.out.println(s1.equals(s2));       System.out.println(s2.equals(s3));    } }Outputtrue falseYou can also compare two strings using == operator. But, it compares references to the given ... Read More

Including Third-Party Libraries in SAPUI5 Project

Ali
Ali
Updated on 26-Feb-2020 06:20:56

494 Views

You would rather use it like below −jQuery.sap.require("sap.ui.thirdparty.jqueryui.jquery-ui-core");Note that jQuery does not have any security-related documentation on their site, but they are known to be aware of security and usually reacting quickly in case security issues are found within their library.SAPUI5 includes different versions of jQuery together with their own libraries, so also has the possibility to add custom security fixes to jQuery, if necessary.For more details you can refer to below SAP blog −https://blogs.sap.com/2017/04/30/how-to-include-third-party-libraries-modules-in-sapui5/

Searching Characters in a String in Java

Jai Janardhan
Updated on 26-Feb-2020 06:13:58

9K+ Views

You can search for a particular letter in a string using the indexOf() method of the String class. This method which returns a position index of a word within the string if found. Otherwise it returns -1.Examplepublic class Test {    public static void main(String args[]) {       String str = new String("hi welcome to Tutorialspoint");       int index = str.indexOf('w');       System.out.println("Index of the letter w :: "+index);    } }OutputIndex of the letter w :: 3

Integration of Hybris with SAP ERP

Monica Mona
Updated on 26-Feb-2020 06:12:28

157 Views

Many companies have an on-premise solution that contains master data, customer and product information, and pricing data. Details from SAP ECC system is required when opportunities are won and the sales order is generated.Following are the key reasons why an integration is required with SAP ERP and CRM system −To provide an organization level solution for all sales, marketing and service activities including all subsidiaries, sales offices.Many companies prefer as SAP Cloud solution for customer user experience that helps sales representatives to provide outstanding customer experience and SAP CRM as back-end system to support key activities.An organization wants to extend ... Read More

Combining LIKE and CONTAINS Operator in SAP HANA

Samual Sam
Updated on 26-Feb-2020 06:11:45

928 Views

The code you are using \1+ just removes consecutive occurrences only. You can use the below code.SELECT REPLACE_REGEXPR('(.)(?=.*\1)' IN '22331122' WITH '' OCCURRENCE ALL)  FROM DUMMYThe output will come out to be “312”. This will remove all multiple occurrences and only last one will be kept.

Passing Multiple Parameters in SAP BO Webi Report

Johar Ali
Updated on 26-Feb-2020 06:11:12

1K+ Views

An open document URL is constructed as follow −http://:/OpenDocument/opendoc/?&&...&With use of SAP Business Objects API, you can query each prompt- single value or multiple value. When you build URL, you may have to include parameter types.You can join parameters with the ampersand (&) and you shouldn’t use space with & ampersand. Example − sType=wid&sDocName=Sales2003https://URL_path/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&sType=wid&sRefresh=Y&iDocID=AUcrjvCCPOVHtSvXJV9Qs0k&lsMYBO_BU=B;B&lsSYBO_CALYEAR=201710&lsSYBO_CRNCY=USDIn this URL, you can see single value variable YBO_CALYEAR and value is passed in YYYYMM format&lsSYBO_CRNCY=USD, you can see single value variable and I am passing value “USD”When you run the report, you can define a report level variable or use report-level function to capture multiple ... Read More

What Does the Method addElement(E obj) Do in Java?

Rishi Raj
Updated on 26-Feb-2020 06:10:20

442 Views

The addElement(E obj) method is used to add the specified component to the end of this vector and increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity. This addElement() method is identical in functionality to the add(Object) method. The add() method returns true/false but the addElement() method does not return any value.Exampleimport java.util.Vector; public class VectorDemo {    public static void main(String[] args) {       Vector vec = new Vector(4);       vec.add(4);       vec.add(3);       vec.add(2);       vec.add(1);       System.out.println("Initial ... Read More

Append a Single Character to a String or Char Array in Java

Paul Richard
Updated on 26-Feb-2020 06:04:55

3K+ Views

The append() method in the StringBuffer class adds the specified String to the contents of the current String buffer. Using this method you can append a single character to a string or char array in java.Examplepublic class Test {    public static void main(String args[]) {       StringBuffer sb = new StringBuffer("Hi hello how are yo");       sb.append("u");       System.out.println(sb);    } }OutputHi hello how are you

Advertisements