乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 88|回复: 5

Diesel表达式-在分隔符后选择正确的值-

[复制链接]

2

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
10
发表于 2016-6-16 10:03:29 | 显示全部楼层 |阅读模式
我想取选项卡后的最后一个数字 -
示例I序列号,即文件名。
1.dwg |2.dwg |...|985.dwg
在本例中,审阅为 0(零)必须具有此值
当项目具有审阅 adiociono 分隔符 -
1-1.dwg此项目具有 1 个审阅。
2-5.dwg该项目有5个评论。
985-15.dwg此项目有 15 个修订版 - kkkkk 哦,
我的上帝,我试图搜索 Diesel 表达式 SPLIT 方法,但没有。
如何获取自定义字段
,我正在等待
谢谢

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

33

主题

153

帖子

4

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2016-6-16 12:54:43 | 显示全部楼层
也许这会有所帮助。
我使用类似的表达式来解析图形名称并删除/包含破折号或其他文本。 您可能需要修改此 ..但拿走你需要的东西。
$(substr,$(getvar,dwgname),1,3)
将返回绘图名称的前三个字母。
我想这取决于您的绘图命名约定的完整图案化。在评论计数之前,您是否有固定的字符数?
这可能也会有所帮助。
http://www.crlf.de/Dokumente/Diesel/Diesel.html
也发现了这个
  1. /*                               D I E S E L
  2.        Dumb Interpretively Evaluated String Expression Language
  3.     This "Dumb Interpretively Executed String Expression Language" is  the
  4.     kernel  of        a  macro  language  you can customise by adding C code and
  5.     embedding it into your program.
  6.     It is short, written in portable C, and is readily integrated into any
  7.     program.   It  is  useful  primarily  to  programs        which  need a very
  8.     rudimentary macro expansion facility without the complexity of a  full
  9.     language such as Lisp or FORTH.
  10.     DIESEL  copies  its  input        directly  to  the  output  until  a  macro
  11.     character, "$" or quoted string is encountered.  Quoted strings may be
  12.     used  to  suppress        evaluation  of sequences of characters which would
  13.     otherwise be interpreted as macros.  Quote marks may  be  included        in
  14.     quoted strings by two adjacent quote marks.  For example:
  15.         "$(if,1,True,False)="""$(if,1,True,False)""""
  16.     Status  retrieval,        computation,  and  display are performed by DIESEL
  17.     functions.        The available  functions  are  as  follows.   User-defined
  18.     functions  are  not  implemented;  what  you  see  is  all you've got.
  19.     Naturally, if  you        embed  DIESEL  in  your  application,  you'll  add
  20.     functions  that  provide access to information and actions within your
  21.     own program.  DIESEL's arithmetic  functions  accept  either  floating
  22.     point  or  integer arguments, and perform all calculations in floating
  23.     point.
  24.     DIESEL String Functions
  25.     -----------------------
  26.     $(+,,,...)
  27.         The  sum  of  the  numbers , , ... is returned.
  28.     $(-,,,...)
  29.         The  result  of subtracting the numbers  through  from
  30.          is returned.
  31.     $(*,,,...)
  32.         The result of multiplying the numbers  ,,...        is
  33.         returned.
  34.     $(/,,,...)
  35.         The  result of dividing the number  by ,...   is
  36.         returned.
  37.     $(=,,)
  38.         If the        numbers    and    are  equal  1  is  returned,
  39.         otherwise 0 is returned.
  40.     $(,)
  41.         If  the number  is less than  1 is returned, otherwise
  42.         0 is returned.
  43.     $(>,,)
  44.         If the number    is  greater  than    1  is  returned,
  45.         otherwise 0 is returned.
  46.     $(!=,,)
  47.         If  the  numbers    and   are not equal 1 is returned,
  48.         otherwise 0 is returned.
  49.     $(,)
  50.         If the number   is  less        than  or  equal  to    1        is
  51.         returned, otherwise 0 is returned.
  52.     $(>=,,)
  53.         If  the  number    is  greater  than or equal to  1 is
  54.         returned, otherwise 0 is returned.
  55.     $(AND,,,...)
  56.         The bitwise logical AND of the integers  through                is
  57.         returned.
  58.     $(EQ,,)
  59.         If the strings  and   are  identical  1  is  returned,
  60.         otherwise 0.
  61.     $(EVAL,)
  62.         The  string  is passed to the DIESEL evaluator and the result
  63.         of evaluating it is returned.
  64.     $(FIX,)
  65.         The real number  is truncated to an integer  by        discarding
  66.         any fractional part.
  67.     $(IF,,,)
  68.         If    is        nonzero,    is        evaluated  and         returned.
  69.         Otherwise,    is  evaluated  and returned.  Note that the
  70.         branch not chosen by  is not evaluated.
  71.     $(INDEX,,)
  72.          is assumed to contain one or more values delimited by the
  73.         macro argument separator character, comma.   selects one of
  74.         these values to be extracted, with the first item  numbered  zero.
  75.     $(NTH,,,,)
  76.         Evaluates  and        returns  the  argument        selected  by  .        If
  77.          is 0,  is returned, and so on.  Note the        difference
  78.         between  $(NTH)  and  $(INDEX);  $(NTH) returns one of a series of
  79.         arguments to the function while $(INDEX) extracts a value  from  a
  80.         comma-delimited string passed as a single argument.  Arguments not
  81.         selected by  are not evaluated.
  82.     $(OR,,,...)
  83.         The  bitwise  logical  OR of the integers  through  is
  84.         returned.
  85.     $(STRFILL,,)
  86.         Returns the result of concatenating  of .
  87.     $(STRLEN,)
  88.         Returns the length of  in characters.
  89.     $(SUBSTR,,,)
  90.         Returns  the  substring  of  starting at character
  91.         and extending for  characters.        Characters in  the  string
  92.         are numbered from 1.  If  is omitted, the entire remaining
  93.         length of the string is returned.
  94.     $(UPPER,)
  95.         The   is returned converted to upper case according to the
  96.         rules of the current locale.
  97.     $(XOR,,,...)
  98.         The bitwise logical XOR of the integers  through                is
  99.         returned.
  100. ...
  101. */

回复

使用道具 举报

51

主题

613

帖子

9

银币

中流砥柱

Rank: 25

铜币
815
发表于 2016-6-16 17:14:50 | 显示全部楼层
我会建议如下,但我相信DIESEL对计算表达式有256个字符的限制,所以这不太可能奏效。
  1. $(if,$(eq,-,$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),6),1)),
  2.     $(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),5),2),
  3.     $(if,$(eq,-,$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),5),1)),
  4.         $(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),4),1),
  5.         0
  6.      )
  7. )

这里有一个类似的话题:
https://www.theswamp.org/index.php?topic=48081.0
回复

使用道具 举报

33

主题

153

帖子

4

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2016-6-17 08:26:55 | 显示全部楼层
您最好的选择是对文件名进行标准化。柴油不识别连字符作为分隔符,非常确定它只是CSV样式。
我会从000-00到985-15等。
015-12
将返回12
123-05
将返回05
回复

使用道具 举报

33

主题

153

帖子

4

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2016-6-17 18:17:42 | 显示全部楼层
如果您的修订符号至少始终为 2 位数字(01 到 99),则可以使用数学函数来确定位置开始
字符串 - 5((2 位数字加上“.dwg”),
因此无论您的文件名长度如何,都可以在 “.
回复

使用道具 举报

33

主题

153

帖子

4

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
285
发表于 2016-6-17 18:31:17 | 显示全部楼层
喜欢这个。。。。
  1. $(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),5),2)

无论字符数如何,它都会返回“.”之前的最后两位数字。
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 22:03 , Processed in 0.657894 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表