Useful String Methods

Description

Slide Set on Useful String Methods, created by Shannon Anderson-Rush on 16/08/2019.
Shannon Anderson-Rush
Slide Set by Shannon Anderson-Rush, updated more than 1 year ago
Shannon Anderson-Rush
Created by Shannon Anderson-Rush over 5 years ago
2309
0

Resource summary

Slide 1

    This method is used to find the length of a String. The int indicates that the length method will store and return an integer.
    int length()

Slide 2

    This method is used to create a substring of the original string. The substring will start at index from and end at to -1 (the first index position is inclusive while the stopping index position is exclusive). You must use the given parameters in order to know what substring is created.
    String substring(int from, int to)

Slide 3

    This method returns a substring starting at index from and continuing to the length( ) of the original String.
    String substring(int from)

Slide 4

    This method will return an integer stating at the index position of the first occurrence of str located within the string.  
    int indexOf(String str) 

Slide 5

    This method will return the character located at the specified index position.
    char charAt(int index)

Slide 6

    This method compares two strings while ignoring the case.  It returns a true value if the two strings are identical regardless of case and false if they are not equal.  
    boolean equalsIgnoreCase (String str) 

Slide 7

     This method will replace an existing character within a string with a new character.
    String replace(char oldChar, char newChar)

Slide 8

    This method compares the first String with the String referenced by other. Comparing is like putting them in alphabetical order. The method does not actually order the two Strings, however, it will tell you which String would come first. It does this by returning a positive value if the first String comes after other, or a negative value if the first String comes before other. If the words are exactly the same, it will return a zero. When comparing Strings, uppercase comes before lowercase.
    int compareTo(String other)
Show full summary Hide full summary

Similar

Common Technology Terms
Julio Aldine Branch-HCPL
Project Communications Management
farzanajeffri
Network Protocols
Shannon Anderson-Rush
Abstraction
Shannon Anderson-Rush
Computing
Kwame Oteng-Adusei
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Introduction to the Internet
Shannon Anderson-Rush
Construcción de software
CRHISTIAN SUAREZ
Historical Development of Computer Languages
Shannon Anderson-Rush
Web Designing & Development Full Tutorial
Nandkishor Dhekane
LAN and WAN
Nathan Roberts