String Methods - Java

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/40

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

41 Terms

1
New cards

charAt()

returns the character at a specified index

2
New cards

What would the code return?

String myStr = "Hello";
char result = myStr.charAt(0);
System.out.println(result);

H

3
New cards

codePointAt()

returns the Unicode of a character at a specified index

4
New cards
<p>What would the code return?</p><pre><code class="language-Java">String myStr = "Hello";
int result = myStr.codePointAt(0);
System.out.println(result);</code></pre><p></p>

What would the code return?

String myStr = "Hello";
int result = myStr.codePointAt(0);
System.out.println(result);

72

5
New cards

codePointBefore()

returns the Unicode of a character before the specified index

6
New cards
<p>What would the code return?</p><pre><code>String myStr = "Hello";
int result = myStr.codePointBefore(1);
System.out.println(result);</code></pre><p></p>

What would the code return?

String myStr = "Hello";
int result = myStr.codePointBefore(1);
System.out.println(result);

72

7
New cards

codePointCount()

returns the number of Unicode values found in a string

8
New cards

What would the code return?

String myStr = "Hello";
int result = myStr.codePointCount(0, 5);
System.out.println(result);

5

9
New cards

compareTo()

compares two strings lexicographically.

10
New cards

What would the code return?

String myStr1 = "Hello";
String myStr2 = "Hello";
System.out.println(myStr1.compareTo(myStr2));

0

11
New cards

compareToIgnoreCase()

compares two strings lexicographically, ignoring case differences

12
New cards

What would the code return?

String myStr1 = "HELLO";
String myStr2 = "hello";
System.out.println(myStr1.compareToIgnoreCase(myStr2));

0

13
New cards

concat()

14
New cards

contains()

checks whether a string contains a character sequence

15
New cards

What would the code return?

String myStr = "Hello";
System.out.println(myStr.contains("Hel"));   // true
System.out.println(myStr.contains("e"));     // true
System.out.println(myStr.contains("Hi"));    // false

true

true

false

16
New cards

format()

17
New cards

What would the code return?

18
New cards

getChars()

19
New cards

What would the code return?

20
New cards

indexOf()

21
New cards

What would the code return?

22
New cards

isEmpty()

23
New cards

What would the code return?

24
New cards

join()

25
New cards

What would the code return?

26
New cards

length()

27
New cards

What would the code return?

28
New cards

split()

29
New cards

What would the code return?

30
New cards

substring()

31
New cards

What would the code return?

32
New cards

subSequence()

33
New cards

What would the code return?

34
New cards

toLowerCase()

35
New cards

What would the code return?

36
New cards

toUpperCase()

37
New cards

What would the code return?

38
New cards

toString()

39
New cards

What would the code return?

40
New cards

trim()

41
New cards

What would the code return?