mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +08:00
18 lines
1.4 KiB
Go
18 lines
1.4 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
package algo ;import _e "strconv";
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
|
func NaturalLess (lhs ,rhs string )bool {_cea ,_b :=0,0;for _cea < len (lhs )&&_b < len (rhs ){_f :=lhs [_cea ];_gf :=rhs [_b ];_cf :=_g (_f );_ced :=_g (_gf );switch {case _cf &&!_ced :return true ;case !_cf &&_ced :return false ;case !_cf &&!_ced :if _f !=_gf {return _f < _gf ;
|
|
};_cea ++;_b ++;default:_cc :=_cea +1;_bd :=_b +1;for _cc < len (lhs )&&_g (lhs [_cc ]){_cc ++;};for _bd < len (rhs )&&_g (rhs [_bd ]){_bd ++;};_a ,_ :=_e .ParseUint (lhs [_cea :_cc ],10,64);_fd ,_ :=_e .ParseUint (rhs [_cea :_bd ],10,64);if _a !=_fd {return _a < _fd ;
|
|
};_cea =_cc ;_b =_bd ;};};return len (lhs )< len (rhs );};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_bdg :=make ([]byte ,len (s )*cnt );_d :=[]byte (s );for _ceac :=0;_ceac < cnt ;_ceac ++{copy (_bdg [_ceac :],_d );};return string (_bdg );
|
|
};func _g (_ce byte )bool {return _ce >='0'&&_ce <='9'}; |