3 strings

1 String (String) be a finite sequence of zero or more characters.

Custom function to achieve a 1.1 to Integer String function

Special cases

  1. Blank header can be excluded, counted from the first non-blank character
  2. In allowing the digital sign (+ -) at the beginning of
  3. Encounter illegal characters will stop the conversion, returns the current value has been converted, if that is the beginning of the illegal character returns 0
  4. Returns a specific value at the conversion result overflows, this is the largest / smallest integer

Test Case

  " 010"," +004500"," -001+2a42"," +0 123" ,"-2147483648", "2147483648",

  " - 321", " -11919730356x" ,"9223372036854775809"

Correct output

  10,4500,-1 ,0,-2147483648,2147483647,0,-2147483648,2147483647

Guess you like

Origin www.cnblogs.com/sketeton/p/11688429.html