ๆฅตๅฐๅ ฑ้ๆฑๅใ่งฃใๅฟ ่ฆใใใฃใฆ, ๆ้ทๅ ฑ้้จๅๆๅญๅใฎใใฎ, O(mn)ใงใใDPใจๅ จใๅๆงใซ่งฃใใ. ใใใใใฃใกใ้ ใใฃใฆ, C++ใงๆธใ็ดใใฆใ.
ใง, nodeใๆฑใๆๅญๅใฏ็กๆกไปถใงutf-8 ใงใใ. c++ใฎๅ ้จใงใ, ใใใใใฎใใใซๆฑใๅฟ ่ฆใใใ.
ใพใฃใใใAPIใฎๅๅใ็ดใใใใใ Write ใจใใๅๅใใWriteUtf8 ใจใใๅๅใใ
ไปๅใ็งใๆฐใใๅญฆใใ APIใซใคใใฆใฎใฟๆธใใ
v8::Value::IsString()
// Arguments& args
args[0]->IsString();v8::Value::ToString()
// Arguments& args
Local<String> str = args[0]->ToString();v8::Value::Length()
// Arguments& args
int n = args[0]->Length();ๅคๆใใใๅใซใ String#length ใง้ทใใๅๅพใใๅฟ
่ฆใใใใ
// Local<String> str
int n = str->Length();
uint16_t s[n];
str->Write(s);Write ใฏใใใใ sprinf ใงใใใ ใพใใWriteAscii ใจใ WriteUtf8 ใใใใใ ไปใฏไฝฟใใฉใใงใฏใชใใ
uint16_t s[14];
// assign into s[0] to s[12]
s[13] = 0; // last must be '\n'
Local<String> str = String::New(us));