|
|
|
อยากได้ Code แปลงเลขจากเลขไทยเป็นเลขอารบิก ใครรู้ช่วยทีเถอะครับ |
|
|
|
|
|
|
|
$message = "๑,๒๓๔,๕๖๗๘ บาท";
$numthai = array("๑","๒","๓","๔","๕","๖","๗","๘","๙","๐");
$numarabic = array("1","2","3","4","5","6","7","8","9","0");
$test = str_replace($numthai,$numarabic,$message);
echo $test;
ลองดูครับ
|
|
|
|
|
Date :
15 ส.ค. 2551 11:14:00 |
By :
Rutz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้ว ฟังก์ชั่น str_replace( ) ที่ว่า มันมาจากไหนครับ มาได้ยังไง ..???
|
|
|
|
|
Date :
2014-09-18 09:16:52 |
By :
อ๊อดดี้ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
public class ArabicToThai {
static char[][]numthai = {{'1','๑'},{'2','๒'},{'3','๓'},{'4','๔'},{'5','๕'},{'6','๖'},{'7','๗'},{'8','๘'},{'9','๙'},{'0','๐'}};
public static void main(String[] args) {
String s="สล 14 63";
String resualt= arabicToThai(s);
System.out.println(resualt);
}
public static String arabicToThai(String input){
String test ="";
for(int i = 0;i<input.length();i++){
char check=input.charAt(i);
for(int j = 0 ;j<numthai.length;j++){
if(check==numthai[j][0]){
check=numthai[j][1];
}
}
test += check;
}
return test;
}
}
|
|
|
|
|
Date :
2016-01-06 16:30:27 |
By :
yossiri Omega file (SPU) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
https://github.com/OkveeNet/number
Code (PHP)
require 'Okvee/Number/NumberThai.php';
$numthai = new Okvee\Number\NumberThai();
echo $numthai->arabicToThaiNumber('รอ 2 นาที 30 วินาที.').'<br>';
echo $numthai->thaiToArabicNumber('รอ ๓ นาที ๔๕ วินาที.').'<br>';
|
|
|
|
|
Date :
2016-01-06 16:50:25 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|