How to see if an NSString starts with a certain other string?

后端 未结 5 1751
无人及你
无人及你 2020-12-23 08:51

I am trying to check to see if a string that I am going to use as URL starts with http. The way I am trying to check right now doesn\'t seem to be working. Here is my code:<

5条回答
  •  [愿得一人]
    2020-12-23 09:28

    Swift version:

    if line.hasPrefix("#") {
      // checks to see if a string (line) begins with the character "#"
    }
    

提交回复
热议问题