函数功能描述 来源: 作者: 作者原述: 猫壹佰描述: 为值列表添加或替换新值 测试文档下载: 调用范例 PutValue18 ( "1¶3¶5" ; 2 ; "yellow" )PutValue18 ( "1¶3¶5" ; 5 ; "yellow" ) 返回结果 "1¶yellow¶5""1¶3¶5¶¶yellow" 函数内容 /* ===================================== # PutValue18 ( ValueList ; ValueNumber ; ReplaceString ) # # Complement to GetValue, replacing a given value number with ReplaceString # Returns the new value list complete with ReplaceString # # Parameters: # ValueList: a ¶-delimited value list # ValueNumber: the value into which ReplaceString should be placed, replacing current value # ReplaceString: new value # # Notes: # If ValueNumber > ValueCount ( ValueList ), more values will be added before ReplaceString so that # it will be value # ValueNumber # (only recursion is in While statement adding extra values) # If ReplaceString is "" then value ValueNumber will be empty # ReplaceString can include ¶, so Result may contain more values than original ValueList # # Examples: PutValue18 ( "1¶3¶5" ; 2 ; "yellow" ) = "1¶yellow¶5" # PutValue18 ( "1¶3¶5" ; 5 ; "yellow" ) = "1¶3¶5¶¶yellow" # PutValue18 ( "1¶9¶3¶577¶6" ; 3 ; GetValue ( "1¶9¶3¶577¶6" ; 3 ) & ¶ & "yellow" ) = "1¶9¶3¶yellow¶577¶6" # # By Bill Thurmes, MDCA # revised 9/8/2016, header reformatted for clarity 2/16/2019; Changed with While 10/17/2019 ========================================*/ Let ( [ ~VL = Case ( PatternCount ( ValueList ; ¶ ) < ValueNumber - 1 ; While ( [ `v = ValueList ; `n = ValueNumber ; `c = PatternCount ( ValueList ; ¶ ) ] ; //end While initial GetAsNumber ( `c ) < `n - 1 ; //While condition [ `v = `v & ¶ ; `c = `c + 1 ] ; //end While Logic `v ) ; //end While ValueList ) ; //end Case ~N = ValueNumber - 1 ; ~B = Position ( ~VL ; ¶ ; 1 ; ~N ) ; ~L = Length ( ~VL ) ; ~E = Case ( PatternCount ( ~VL ; ¶ ) ≥ GetAsNumber ( ValueNumber ) ; Position ( ~VL ; ¶ ; 1 ; ValueNumber ) - 1 ; ~L ) ; //end Case ~Result = Case ( PatternCount ( ~VL ; ¶ ) ≥ ValueNumber - 1 ; Left ( ~VL ; ~B ) & ReplaceString & Right ( ~VL ; ~L - ~E ) ; "" ) //end Case ] ; //end variable assignment portion of Let ~Result )//end Let 复制函数内容 当前页面使用FileMaker生成发布, 更新于2021年3月15日0时50分1秒