mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +08:00
18 lines
1.3 KiB
Go
18 lines
1.3 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 _c "strconv";func _f (_g byte )bool {return _g >='0'&&_g <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_bc :=make ([]byte ,len (s )*cnt );_bd :=[]byte (s );for _a :=0;_a < cnt ;_a ++{copy (_bc [_a :],_bd );
|
|
};return string (_bc );};
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
|
func NaturalLess (lhs ,rhs string )bool {_ge ,_bg :=0,0;for _ge < len (lhs )&&_bg < len (rhs ){_e :=lhs [_ge ];_bb :=rhs [_bg ];_fa :=_f (_e );_d :=_f (_bb );switch {case _fa &&!_d :return true ;case !_fa &&_d :return false ;case !_fa &&!_d :if _e !=_bb {return _e < _bb ;
|
|
};_ge ++;_bg ++;default:_ff :=_ge +1;_bgf :=_bg +1;for _ff < len (lhs )&&_f (lhs [_ff ]){_ff ++;};for _bgf < len (rhs )&&_f (rhs [_bgf ]){_bgf ++;};_fd ,_ :=_c .ParseUint (lhs [_ge :_ff ],10,64);_ba ,_ :=_c .ParseUint (rhs [_ge :_bgf ],10,64);if _fd !=_ba {return _fd < _ba ;
|
|
};_ge =_ff ;_bg =_bgf ;};};return len (lhs )< len (rhs );}; |