• 2022-06-07
    获取一个字符在字符串中首次出现的位置,使用()方法。
    A: charAt()
    B: indexOf()
    C: lastIndexOf()
    D: substr()
  • B

    内容

    • 0

      下列方法中,( )用于实现获取字符在某个字符串中第一次出现的索引。 A: char charAt(int index) B: int lastIndexOf(int ch) C: boolean endsWith(String suffix) D: int indexOf(int ch)

    • 1

      从一个字符串中取出指定位置的字符,采用String类中的()方法。 A: charAt() B: endsWith() C: indexOf() D: substring()

    • 2

      String类中用于获取指定索引处的字符的方法是()。 A: charAt(intindex) B: indexOf(intc) C: lastIndexOf(intc) D: get(intindex)

    • 3

      获取字符串中某个索引对应的字符使用方法( )。 A: indexOf( ) B: charAt( ) C: split( ) D: slice( )

    • 4

      Javascript里String对象通过( )方法取第一次出现子字符串的字符位置。 A: indexOf() B: lastIndexOf() C: toLowerCase() D: toUpperCase()