我是靠谱客的博主 无心人生,最近开发中收集的这篇文章主要介绍lua 字符串分隔,支持以单个字符或字符串进行分隔,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

    1. local function explode ( _str, seperator)
      local pos, arr = 0, {}
      for st, sp in function() return string.find( _str, seperator, pos, true ) end do
      table.insert(arr, string.sub(_str, pos, st-1 ))
      pos = sp + 1
      end
      table.insert(arr, string.sub( _str, pos))
      return arr
      end

    2. local ta2 = explode("hsee_,sdj_,ehi_,djsd","_,")
      local newSt2 = table.concat(ta2,"n")
      print(newSt2)

  • https://blog.csdn.net/li396864285/article/details/79726607

转载于:https://www.cnblogs.com/gongchixin/articles/9763752.html

最后

以上就是无心人生为你收集整理的lua 字符串分隔,支持以单个字符或字符串进行分隔的全部内容,希望文章能够帮你解决lua 字符串分隔,支持以单个字符或字符串进行分隔所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部