using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChectUpString {
private static ChectUpString _instance;
private ChectUpString(){
AnomaliesFont.Add (' ');
}
public static ChectUpString Intance{
get{
if (_instance==null) {
_instance = new ChectUpString ();
}
return _instance;
}
}
List AnomaliesFont = new List ();
//如果有 空格 则回去-1;
public int ChectBlankStrToByteLength(string str){
char[] chars = str.ToCharArray();;
int count = chars.Length;
for (int i = 0; i < count; i++) {
if (AnomaliesFont.Contains (chars[i])) {
return -1;
}
}
//byte[] byteArray = System.Text.Encoding.Default.GetBytes (str);
return count;
}
}
网友评论