Toggle menu
876
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Phonenumber class

From Catglobe Wiki
Revision as of 05:29, 24 March 2020 by Administrator (talk | contribs)

Phonenumber



A phonenumber


Methods

  • bool Any(Function predicate "A function that takes 1 parameter of the types in the array, and return true/false") - Return true if the array contains the element using the given function.
  • bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • array Except(array elements "Elements to remove") - Return all elements that does not exist in the other collection.
  • object First(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition.
  • object FirstOrDefault(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition or empty if not found.
  • int Frequency(number number "The number to search for") - Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • int IndexOf(object element "Element to search for") - Return index of the given element, or -1.
  • bool IsCharacterArray() - check if array is an array of characters
  • bool IsNumericArray() - check if array is an array of integer numbers
  • bool IsStringArray() - check if array is an array of string
  • array OrderBy(Function comparer "Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.") - Sorts the elements of a sequence in ascending order by using a specified comparer.
  • Empty ParseNumber(string value "Formatted value", int CountryCallingCode "Digit(s) dial after the +") - Parse number from formatted value
  • Empty ParseNumber(string value "Formatted value", string countryIso "Iso code of the country the number is in") - Parse number from formatted value
  • Empty Randomize() - Randomize the order of the elements in the current array.
  • array Reverse() - Returns an array with all the elements in the opposite order.
  • array Select(Function selector "A transform function to apply to each element.") - Projects each element of a sequence into a new form.
  • array SelectMany(Function selector "A transform function to get each sub array.") - Projects each array element of a sequence into a new form.
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • array Skip(int n "How many elements to skip") - Get all but the n first elements.
  • array Take(int n "How many elements to take") - Get the n first elements.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.") - Return a dictionary with the elements of the array.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.", Function valueSelector "A transform function to get the value of each element.") - Return a dictionary with the elements of the array.
  • string ToString() - The string representation of the object.
  • Empty UpdateNumber(string areaCode "New areacode", string number "New number") - Update number from formatted value
  • array Where(Function predicate "A function that takes 1 parameter of the types in the array and return true/false") - Filters a sequence of values based on a predicate.

Properties

  • number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
  • int CountryCallingCode { get; } - Digit(s) dial after the +
  • string CountryIso { get; } - Iso code of the country the number is in
  • string Extension { get; set; } - Extension part of the phonenumber
  • string FormattedNumber { get; } - Number formatted for display
  • number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
  • number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
  • string ObjectTypeName { get; } - The name of the type of object.
  • number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

//Add new number
User user = User_getUserByResourceId(2014917);
user.PhoneNumbers = {{PhoneNumber_Type_NotIdentified, "29568978", 45}};
user.Save();
print(user.PhoneNumbers[0].FormattedNumber);//29568978
print(user.PhoneNumbers[0].CountryCallingCode);//45
print(user.PhoneNumbers[0].CountryIso);//dk
print(user.PhoneNumbers[0].Extension);// empty
//ParseNumber
User user = User_getUserByResourceId(2014917);
if (user.PhoneNumbers.Count > 0)
{
	
	string formattedNumber = "29568979";
	string countryIso = "vn";
	user.PhoneNumbers[0].ParseNumber(formattedNumber, countryIso);
	user.PhoneNumbers[0].Extension = "1";
	user.Save();
	print(user.PhoneNumbers[0].FormattedNumber);//29568979#1
	print(user.PhoneNumbers[0].CountryCallingCode);//84
	print(user.PhoneNumbers[0].CountryIso);//vn
	print(user.PhoneNumbers[0].Extension);//1
}
//UpdateNumber
User user = User_getUserByResourceId(2014917);
if (user.PhoneNumbers.Count > 0)
{
	
	string areaCode = "2";
	string formattedNumber = "29568999";
	user.PhoneNumbers[0].UpdateNumber(areaCode,formattedNumber);
	user.Save();
	print(user.PhoneNumbers[0].FormattedNumber);//229568999#1
	print(user.PhoneNumbers[0].CountryCallingCode);//84
	print(user.PhoneNumbers[0].CountryIso);//vn
	print(user.PhoneNumbers[0].Extension);//1
}