File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,29 @@ impl Executor {
429
429
self . stack . push ( Type :: String ( text. repeat ( count as usize ) ) ) ;
430
430
}
431
431
432
+ // 数値からユニコード文字列を取得
433
+ "decode" => {
434
+ let code = self . pop_stack ( ) . get_number ( ) ;
435
+ let result = char:: from_u32 ( code as u32 ) ;
436
+ match result {
437
+ Some ( c) => self . stack . push ( Type :: String ( c. to_string ( ) ) ) ,
438
+ None => {
439
+ self . log_print ( "エラー! 数値デコードに失敗しました" . to_string ( ) ) ;
440
+ self . stack . push ( Type :: Number ( code) ) ;
441
+ }
442
+ }
443
+ }
444
+
445
+ "encode" => {
446
+ let string = self . pop_stack ( ) . get_string ( ) ;
447
+ if let Some ( first_char) = string. chars ( ) . next ( ) {
448
+ self . stack . push ( Type :: Number ( ( first_char as u32 ) as f64 ) ) ;
449
+ } else {
450
+ self . log_print ( "エラー! 文字列のエンコードに失敗しました" . to_string ( ) ) ;
451
+ self . stack . push ( Type :: String ( string) )
452
+ }
453
+ }
454
+
432
455
// 文字列を結合
433
456
"concat" => {
434
457
let b = self . pop_stack ( ) . get_string ( ) ;
You can’t perform that action at this time.
0 commit comments