mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +08:00
15 lines
1.3 KiB
Go
15 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 _e "strconv";
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
|
func NaturalLess (lhs ,rhs string )bool {_g ,_c :=0,0;for _g < len (lhs )&&_c < len (rhs ){_fa :=lhs [_g ];_ge :=rhs [_c ];_a :=_fg (_fa );_eed :=_fg (_ge );switch {case _a &&!_eed :return true ;case !_a &&_eed :return false ;case !_a &&!_eed :if _fa !=_ge {return _fa < _ge ;};_g ++;_c ++;default:_ag :=_g +1;_b :=_c +1;for _ag < len (lhs )&&_fg (lhs [_ag ]){_ag ++;};for _b < len (rhs )&&_fg (rhs [_b ]){_b ++;};_ce ,_ :=_e .ParseUint (lhs [_g :_ag ],10,64);_cd ,_ :=_e .ParseUint (rhs [_g :_b ],10,64);if _ce !=_cd {return _ce < _cd ;};_g =_ag ;_c =_b ;};};return len (lhs )< len (rhs );};func _fg (_ee byte )bool {return _ee >='0'&&_ee <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_bdc :=make ([]byte ,len (s )*cnt );_d :=[]byte (s );for _gg :=0;_gg < cnt ;_gg ++{copy (_bdc [_gg :],_d );};return string (_bdc );}; |