New string features coming with Synergy/DE 11
✕
  • Solutions
    • Legacy Application Modernization
    • Distributed Computing
    • Modern UI/UX
    • Data Visibility
    • Enterprise Application Integration
    • Development Environment Optimization
    • Cloud Migration
    • Security
    • High Availability and Resilience
  • Products
    • Language
    • Development Environment
    • .NET Integration
    • Streaming Integration Platform
    • Web Services Framework
    • Roadmap
  • Services and Support
    • Professional Services Group
    • Developer Support
    • Application Support
  • Learning
    • Events
    • Online Courses
    • White Papers
    • Case Studies
    • Learning Resources
    • Blog
    • Synergy-e-News
  • Company
    • Leadership
    • Careers
    • Contact
    • News
  • +1-916-635-7300
  • Get Support
  • Documentation
  • Resource Center
✕
            No results See all results
            New string features coming with Synergy/DE 11
            • Solutions
              • Legacy Application Modernization
              • Distributed Computing
              • Modern UI/UX
              • Data Visibility
              • Enterprise Application Integration
              • Development Environment Optimization
              • Cloud Migration
              • Security
              • High Availability and Resilience
            • Products
              • Language
              • Development Environment
              • .NET Integration
              • Streaming Integration Platform
              • Web Services Framework
              • Roadmap
            • Services and Support
              • Professional Services Group
              • Developer Support
              • Application Support
            • Learning
              • Events
              • Online Courses
              • White Papers
              • Case Studies
              • Learning Resources
              • Blog
              • Synergy-e-News
            • Company
              • Leadership
              • Careers
              • Contact
              • News
            • +1-916-635-7300
            • Get Support
            • Documentation
            • Resource Center
            ✕
                      No results See all results
                      New string features coming with Synergy/DE 11
                      • Solutions
                        • Legacy Application Modernization
                        • Distributed Computing
                        • Modern UI/UX
                        • Data Visibility
                        • Enterprise Application Integration
                        • Development Environment Optimization
                        • Cloud Migration
                        • Security
                        • High Availability and Resilience
                      • Products
                        • Language
                        • Development Environment
                        • .NET Integration
                        • Streaming Integration Platform
                        • Web Services Framework
                        • Roadmap
                      • Services and Support
                        • Professional Services Group
                        • Developer Support
                        • Application Support
                      • Learning
                        • Events
                        • Online Courses
                        • White Papers
                        • Case Studies
                        • Learning Resources
                        • Blog
                        • Synergy-e-News
                      • Company
                        • Leadership
                        • Careers
                        • Contact
                        • News
                      • Home
                      • Blog
                      • Software Development
                      • New string features coming with Synergy/DE 11

                      New string features coming with Synergy/DE 11

                      Published by Jerry Fawcett on August 19, 2019
                      Categories
                      • Software Development
                      Tags

                      Synergy/DE 11 is bringing many new features, and among those additions are some exciting new abilities within the String class. All of these powerful new features are available in both traditional and Synergy .NET.

                      When dealing with strings, keep in mind that a string is immutable (fancy word for unchangeable), so any time a string variable is changed, a new string variable is created.

                      First, let me list the new methods added, along with existing methods that include new overloads to the String class: 

                      String.IsNullorEmpty(@string) , boolean
                      • Parameter: String to interrogate for null or empty value
                      • Return value: Boolean value indicating whether the string is null or empty
                      String.IsNullorWhitespace(@string) , boolean
                      • Parameter: String to interrogate for null or white-space characters
                      • Return value: Boolean value indicating whether the string contains null or white-space characters

                      New overloads to give precise control on how a string is trimmed:

                      String.Trim() ,string			(exists prior to version 11)
                      • Parameter: None
                      • Return value: String with leading and trailing white-space characters removed
                      String.Trim(@string) ,string 
                      • Parameter: Character(s) to be removed from the string’s beginning and end
                      • Return value: Returned string with passed-in character(s) removed from the beginning and end
                      String.TrimStart(@string) ,string
                      String.TrimEnd(@string) ,string
                      • Parameter: Character(s) to remove from either the string’s start or end
                      • Return value: String with all instances of character(s) removed from start or end

                      New methods to control how characters are removed or inserted into a string:

                      String.Remove(N) ,string
                      • Parameter: Starting position in the string to remove all characters until its end
                      • Return value: String with all characters from passed starting position to end removed
                      String.Remove(N) ,string
                      • Parameter: Starting position in the string to remove all characters until its end
                      • Return value: String with all characters from passed starting position to end removed
                      String.Insert(N, @string) ,string
                      • Parameters:
                        1. Starting position to insert string passed as parameter 2
                        2. String to be inserted
                      • Return value: Returned string with sting passed in parameter 2 inserted

                      New overloads to give more control on concatenating strings together:

                      String.Concat(@string, @string) ,string	(exists prior to version 11)
                      String.Concat(@string, @string, @string) ,string
                      String.Concat(@string, @string, @string, @string) ,string
                      String.Concat([#]@string) ,string
                      • Parameters:
                        1. Two strings to concatenate together
                        2. Three strings to concatenate together
                        3. Four strings to concatenate together
                        4. Dynamic string array to concatenate all elements together
                      • Return value: Returned string after concatenation operation

                      New overloads to locate the position of a substring in a string:

                      String.IndexOf(A1) ,int			(exists prior to version 11)
                      String.IndexOf(A1, N) ,int
                      String.IndexOf(A1, N, N) ,int		(exists prior to version 11)
                      • Parameters:
                        1. Character(s) to find in string
                        2. Character(s) to find in string starting at position specified in parameter 2
                        3. Character(s) to find in string starting at position specified in parameter 2 for the length of parameter 3
                      • Return value: Integer value with first position of passed character(s)

                      New overloads to find the last occurrence of a substring in a string:

                      String.LastIndexOf(A1) ,int		(exists prior to version 11)
                      String.LastIndexOf(A1,N) ,int
                      String.LastIndexOf(A1,N,N) ,int		(exists prior to version 11)

                      Parameters:

                      • Parameters
                        1. Numeric value of the starting position to begin returning the substring
                        2. Numeric value of the length of the substring to return
                      • Return value: Returned substring with value from the specified starting and length values

                      New methods to create an array from a delimited string:

                      String.Split(A1) ,[#]string
                      String.Split(A1, StringSplitOptions) ,[#]string (see below for the StringSplitOptions enumeration)
                      • Parameters:
                        1. Character(s) to use a delimiter
                        2. Enumeration StringSplitOptions to control if empty elements are created
                        3. Return value: Dynamic string array to be populated with the contents of the passed string

                      New overload to use the replace method on alphas:

                      String.Replace(A, A) ,string
                      • Parameters:
                        1. Alpha value to be replaced by parameter 2
                        2. Alpha value to replace all occurrences of parameter 1 in string
                      • Return value: Returned string with all occurrences of parameter 1 replaced by parameter 2
                      String.Replace(@string, @string) ,string 	(exists prior to version 11)
                      • Parameters
                        1. String value to be replaced by parameter 2
                        2. String value to replace all occurrences of parameter 1 in string
                      • Return value: Returned string with all occurrences of parameter 1 replaced by parameter 2

                      And finally, the enumeration StringSplitOptions, which is used with the Split method to control if empty elements are created when creating the string array:

                      public enum StringSplitOptions
                          None		,0
                          RemoveEmptyEntries	,1

                      You can find details on all String members in the System.String topic in the Synergy/DE documentation.

                      As I mentioned earlier, some of the above are brand new methods (Insert, IsNullorWhitespace, Remove, Split, TrimEnd, TrimStart) added to the System.String class, while others are new overload methods added to existing methods to provide additional functionality. Interestingly, the runtime itself will make use of the String.Concat method when strings are added together (e.g., string1 + string), as it is efficient and generates fewer temporary variables.

                      Now let’s take a look at one of the new methods. Using the new Split method, we can populate a dynamic array from a delimited string. Say we have a string containing the following:

                      mystring = “Bob, Mary, Joe, Jack,,,, Fred, Henry, Tom”

                      We’d like for the values between the commas to be elements in an array, but we don’t want the commas without values between them to become empty elements in the array. This can easily be accomplished with the String.Split method using the syntax below:

                      stringarray = mystring.split(“,” , StringSplitOptions.RemoveEmptyEntries)

                      Passing the quoted comma as the first parameter tells the Split method that a comma is the delimiter to look for in the string. Also, for even more control, the delimiter can consist of any number of characters.  There is no need to instantiate the dynamic array, as the dynamic array will automatically be instantiated by the Split method. The result of the above operation will be that the dynamic array stringarray will contain elements with the names that are separated by commas in the string mystring and no empty elements (due to passing StringSplitOptions.RemoveEmptyEntries as the second parameter) for the commas with no values between them:

                      stringarray[1] = “Bob”
                      stringarray[2] = “Mary”
                      stringarray[3] = “Joe”
                      stringarray[4] = “Jack”
                      stringarray[5] = “Fred”
                      stringarray[6] = “Henry”
                      stringarray[7] = “Tom”

                      As you can see, the enhancements to the String class are more than enough reason to upgrade to Synergy/DE 11 when it’s released. If you can’t wait and want to try these new capabilities now, the version 11 beta is available in the Resource Center for download. Don’t forget to set your Synergy/DE documentation to the “Beta” version in the version drop-down near the top of the screen.

                      And wait, there’s more! Now that you’re aware of the new and powerful methods added to the String class, be sure to also check out the new StringBuilder class added to version 11.

                      Share
                      61

                      Leave a ReplyCancel reply

                      This site uses Akismet to reduce spam. Learn how your comment data is processed.

                      • With 40 Years at Synergex, Bill Mooney Is All In
                      • New 12.4 Features Release, 12.4.1.1003
                      • New SDI Release, 2025.06.1647
                      • Simple Strategies to Modernize Your Legacy Code
                      • Unlocking the Power of Modern Web Services: New White Paper Released
                      • Announcements
                      • Beta Testing
                      • Case Studies
                      • Code Exchange
                      • CodeGen
                      • CTO's Thoughts
                      • Development Tools
                      • DevPartner Conference
                      • Education
                      • Events
                      • Harmony Core
                      • Hiring
                      • Industry News
                      • Just for Fun
                      • Licensing
                      • News
                      • Open Source
                      • OpenVMS
                      • President's Thoughts
                      • Professional Services Group
                      • Release Notifications
                      • Security
                      • Software
                      • Software Development
                      • Success Stories
                      • Tech Article
                      • UI
                      • Uncategorized
                      • White Papers

                      STAY CONNECTED with Synergex

                      • Blog
                      • Facebook
                      • LinkedIn
                      • YouTube
                      SOLUTIONS
                      • Legacy Applications Modernization
                      • Modern UI/UX
                      • Data Visibility
                      • Enterprise Application Integration
                      • Development Environment Optimization
                      • Cloud Migration
                      • Security
                      • High Availability
                      PRODUCTS
                      • Language
                      • Development Environment
                      • Connectivity and Open-Source Tools
                      • Release Strategy
                      • Roadmap
                      SUPPORT
                      • Professional Services Group
                      • Developer Support
                      • Application Support
                      LEARNING
                      • Events
                      • Online Courses
                      • Learning Resources
                      • Blog
                      • Synergy-e-News
                      COMPANY
                      • Customers
                      • Leadership
                      • Careers
                      • Contact
                      New string features coming with Synergy/DE 11

                      Privacy  |  Security  |  Terms  |  © 2024 Synergex

                      Harmony Core Office Hours, August 2019
                      August 7, 2019
                      Enhanced CodeGen CreateFile utility
                      August 26, 2019
                      Harmony Core Office Hours, August 2019
                      August 7, 2019
                      Enhanced CodeGen CreateFile utility
                      August 26, 2019