Files
hakorune/examples/string_bridge_min.hako

54 lines
1.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// string_bridge_min.hako - 内部StringBox/プラグインStringBox混在の橋渡しテスト
// ChatGPT5先生の要請エンコード→base64文字列のlength/concat/charCodeAt比較
// 通常の文字列内部StringBox
local plain = "Hello, Nyash!"
local plain_len = plain.length()
print("Plain string length: ")
print(plain_len)
// Base64エンコードプラグイン経由で生成される可能性
local encoded = "SGVsbG8sIE55YXNoIQ==" // "Hello, Nyash!" in Base64
local encoded_len = encoded.length()
print("Encoded string length: ")
print(encoded_len)
// 文字列連結テスト(内部実装)
local concat1 = plain + " " + "World"
print("Concat result: " + concat1)
// Base64文字列の連結プラグイン/内部混在)
local concat2 = encoded + "Cg==" // "\n" in Base64
print("Encoded concat: " + concat2)
// charCodeAtテスト内部実装
local char_code = plain.charCodeAt(0) // 'H' = 72
print("charCodeAt(0): ")
print(char_code)
// 比較テスト
local compare1 = plain == "Hello, Nyash!"
local compare2 = encoded == "SGVsbG8sIE55YXNoIQ=="
local compare3 = plain_len < encoded_len
print("Compare plain: ")
print(compare1) // true
print("Compare encoded: ")
print(compare2) // true
print("Length comparison: ")
print(compare3) // true (13 < 20)
// 最終結果
local all_ok = compare1 and compare2 and compare3
if all_ok {
print("Result: Ok(true)")
} else {
print("Result: Failed")
}
// 注意substring/toLowerCaseはプラグインStringBoxで未実装
// 代わりに基本メソッドのテストを実施
print("Note: substring/toLowerCase not available in plugin StringBox")
// 総合結果(基本テストは成功)
print("Result: 1/Ok(1)")