IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesCorel Paradox  Print This     

String Concatenation (Corel Paradox and Java Cross Reference Guide)

By Mike Prestwood

Corel Paradox versus Java: A side by side comparison between Corel Paradox and Java.

 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

String Concatenation

[Other Languages] 
Corel Paradox:  "String Concatenation" +

String literals s are limited to 255 characters but you can simply add two strings together as in:

s = "A long string." + "Another long string."
Syntax Example:
var
FirstName  String
  LastName  String
endVar
 
FirstName  = "Mike"
LastName  = "Prestwood"
msgInfo("", "Full name: " + FirstName + " " + LastName)
Java:  "String Concatenation" + or append

In Java, you use either the String concatenation + operator or StringBulder class methods such as append. Since Java compilers frequently create intermediate objects when the + operator is used and don't when StringBuilder.append is used, the append method is faster than the + operator.

In general, use the convenience of a + operator when speed is not an issue. For example, when concatenating a small number of items and when code isn't executed very frequently. A decent rule of thumb is to use the + operator for general purpose programming and then optimize the + operator with StringBuilder.append as needed.

Syntax Example:

Simple + operator example:

System.out.println("Hello" + " " + "Mike.");

 

Using StringBuilder example:

StringBuilder myMsg = new StringBuilder();

myMsg.append("Hello ");
myMsg.append("Mike.");
 
System.out.println(myMsg);












Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]