Presentation is loading. Please wait.

Presentation is loading. Please wait.

String Processing 1 MIS 3406 Department of MIS Fox School of Business

Similar presentations


Presentation on theme: "String Processing 1 MIS 3406 Department of MIS Fox School of Business"— Presentation transcript:

1 String Processing 1 MIS 3406 Department of MIS Fox School of Business
Temple University

2 String Object

3 Concatenation

4 Concatenation

5 Accessing Individual Characters

6 Accessing Individual Characters

7 Making Substrings out of Strings – The slice Method
The slice method allows you to specify the start and end positions of the part of the string that you want to extract.

8 Making Substrings out of Strings – The slice Method
The start and end position values do not have to be positive. If you specify a negative value for the end position, the end position for your string is what is left when you count backwards from the end.

9 Making Substrings out of Strings – The slice Method
If you specify a negative start position, your start position is the count of whatever you specify starting from the end of the string.

10 Making Substrings out of Strings – The substr Method
The first argument is a number that specifies your starting position, and the second argument is a number that specifies the length of your substring.

11 Making Substrings out of Strings – The substr Method
The first argument is a number that specifies your starting position, and the second argument is a number that specifies the length of your substring.

12 Making Substrings out of Strings – The substr Method
If you don’t specify the length, the substring that gets returned is the string that goes from the start position to the end

13 Splitting a String – The split Method
Calling the split method on a string returns an array of substrings. These substrings are separated by a character or Regular Expression (aka RegEx) that you use to determine when to split apart your string.

14 Splitting a String – The split Method

15 Finding Something Inside a String – The indexOf Method
The indexOf method takes the character(s) you are looking for as its argument. If what you are looking for is found, it returns the index position in the string where the first occurrence...occurs. If no matches are found, this method gifts you with a -1.

16 Finding Something Inside a String – The indexOf Method
The indexOf method takes the character(s) you are looking for as its argument. If what you are looking for is found, it returns the index position in the string where the first occurrence...occurs. If no matches are found, this method returns a -1.

17 Finding Something Inside a String – The indexOf Method

18 Finding Something Inside a String – The indexOf Method
In addition to providing the characters to search for, you can also specify an index position on your string to start your search from

19 Finding Something Inside a String – The lastIndexOf Method

20 Upper and Lower Casing Strings

21 Challenges Initials SumOfDigits DateConverter MorseCodeConverter
AlphabeticTelephoneNumberTranslator SentenceCapitalizer VowelsAndConsonants MostFrequentCharacter WordSeparator PigLatin

22


Download ppt "String Processing 1 MIS 3406 Department of MIS Fox School of Business"

Similar presentations


Ads by Google