/*
 * SDK Pullenti Lingvo, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software.
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C#.NET project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Utils = require("./../../../unisharp/Utils");

const TextToken = require("./../../TextToken");

class MeasureHelper {
    
    static tryParseDouble(val, f) {
        f.value = 0;
        if (Utils.isNullOrEmpty(val)) 
            return false;
        let inoutres2317 = Utils.tryParseFloat(Utils.replaceString(val, ',', '.'), f);
        if (val.indexOf(',') >= 0 && inoutres2317) 
            return true;
        let inoutres2316 = Utils.tryParseFloat(val, f);
        if (inoutres2316) 
            return true;
        return false;
    }
    
    static isMultChar(t) {
        let tt = Utils.as(t, TextToken);
        if (tt === null) 
            return false;
        if (tt.lengthChar === 1) {
            if (tt.isCharOf("*xXхХ·×◦∙•") || tt.isChar(String.fromCharCode(0x387)) || tt.isChar(String.fromCharCode(0x22C5))) 
                return true;
        }
        return false;
    }
    
    static isMultCharEnd(t) {
        let tt = Utils.as(t, TextToken);
        if (tt === null) 
            return false;
        let term = tt.term;
        if (term.endsWith("X") || term.endsWith("Х")) 
            return true;
        return false;
    }
}


module.exports = MeasureHelper