Strange result from String.Split()

前端 未结 4 750
半阙折子戏
半阙折子戏 2021-01-15 02:59

Why does the following result in an array with 7 elements with 5 blank? I\'d expect only 2 elements. Where are the 5 blank elements coming from?

$a = \'OU=RA         


        
4条回答
  •  轮回少年
    2021-01-15 03:36

    Never mind. Just realised it looks for strings on either side of 'O', 'U', and '='. There are therefore 5 blank chars (in front of the first 'O', between 'O' and 'U', between 'U' and '=', between the second 'O' and 'U', between the second 'U' and '=').

提交回复
热议问题