0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

NCMB.NCMBUser.CurrentUserの配列をint型で取得する方法

Posted at

これでint型の配列としてデータを取得できる

IntTest.cs
   //Character配列取得(なんかしらんけどindex0に全要素が半角空白で区切られて入ってる
   int[] arr = (NCMBUser.CurrentUser["Character"] as ArrayList)[0]
       .ToString()//string型に変換して
       .Split(' ')//半角空白で区切ってstring[]にして
       .Select(int.Parse)//int型に変換して
       .ToArray();//配列にする

stringだったらこれで取得できる
intに変換しないだけなので簡単

StringTest.cs
string[] arr = (NCMBUser.CurrentUser["Character"] as ArrayList)[0]
    .ToString()//string型に変換して
    .Split(' ')//半角空白で区切ってstring[]にして
    .ToArray();//配列にする

そのまま配列としては受け取れないので、ArrayListにキャストしてからToArrayするのが正解っぽい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?