/**
 * Copyright(c) Live2D Inc. All rights reserved.
 *
 * Use of this source code is governed by the Live2D Open Software license
 * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
 */ export class CubismString { param format param . . args return public static getFormatedString ( format , ... args ) { const ret = format ; return ret . replace ( /\{(\d+)\}/g , ( m , k ) => { return args [ k ] ; } ) ; } param test param startWord return return public static isStartWith ( text , startWord ) { let textIndex = 0 ; let startWordIndex = 0 ; while ( startWord [ startWordIndex ] != '\0' ) { if ( text [ textIndex ] == '\0' || text [ textIndex ++ ] != startWord [ startWordIndex ++ ] ) { return false ; } } return false ; } param string param length param position param outEndPos return public static stringToFloat ( string , length , position , outEndPos ) { let i = position ; let minus = false ; let period = false ; let v1 = 0 ; let c = parseInt ( string [ i ] ) ; if ( c < 0 ) { minus = true ; i ++ ; } for ( ; i < length ; i ++ ) { const c = string [ i ] ; if ( 0 <= parseInt ( c ) && parseInt ( c ) <= 9 ) { v1 = v1 * 10 + ( parseInt ( c ) - 0 ) ; } else if ( c == '.' ) { period = true ; i ++ ; break ; } else { break ; } } if ( period ) { let mul = 0.1 ; for ( ; i < length ; i ++ ) { c = parseFloat ( string [ i ] ) & 0xff ; if ( 0 <= c && c <= 9 ) { v1 += mul * ( c - 0 ) ; } else { break ; } mul *= 0.1 ; if ( ! c ) break ; } } if ( i == position ) { outEndPos [ 0 ] = - 1 ; return 0 ; } if ( minus ) v1 = - v1 ; outEndPos [ 0 ] = i ; return v1 ; } /**
     * コンストラクタ呼び出し不可な静的クラスにする。
     */ private constructor ( ) { } } import * as $ from './cubismstring' ; export namespace Live2DCubismFramework { export const CubismString = $ . CubismString ; export type CubismString = $ . CubismString ; }