; By oldstone
text = "		1	2	3	4	5"
str := "Hello, World!"

MsgBox % StrLength(text) 
MsgBox % StrLength(str)


StrLength(myStr) {
  trueStrLength := 1
  charLength := StrLen(myStr) - 2
  if InStr(GetChar(myStr, 1), """")
    i := 2
  else
    i := 1 
  loop, %charLength% {
    myChar := GetChar(myStr, i)
    if InStr(myChar, "`t")
      trueStrLength := Ceil(trueStrLength/4)*4 + 1
    else
      trueStrLength := trueStrLength + 1
    i := i + 1 
  }
  return trueStrLength
}

GetChar(myStr, i) {
  char := substr(myStr, i, 1)
  return char
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。