[C#/VB.net] Smart Haggle

Discussion in 'Code Snippets and Tutorials' started by the_skip, Sep 5, 2007.

  1. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    Code (C#):
    1. <div class="csharp" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> Haggle<span style="color: #000000;">(</span><span style="color: #FF0000;">int</span> hamount<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> Length;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> x;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #FF0000;">int</span> u;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> haggle;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; haggle = <span style="color: #FF0000;">0</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span> stra = hamount.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">(</span>stra.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Length = stra.<span style="color: #0000FF;">Length</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stra = stra.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">1</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span><span style="color: #000000;">(</span>u=<span style="color: #FF0000;">1</span>; u <= Length * <span style="color: #FF0000;">2</span>; u = u + <span style="color: #FF0000;">4</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stra = stra + x.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">(</span> stra.<span style="color: #0000FF;">Length</span> != Length<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stra = stra.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">(</span> <span style="color: #FF0000;">0</span>, Length<span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> stra;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">}</span></li></ol></div>
    VB.net
    Code (Visual Basic):
    1. <div class="vb" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #b1b100;">Public</span> Shared <span style="color: #b1b100;">Function</span> Haggle<span style="color: #66cc66;">(</span>ByVal hamount <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span><span style="color: #66cc66;">)</span> <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">Dim</span> Length <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp;<span style="color: #b1b100;">Dim</span> x <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> u <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">Dim</span> haggle <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;haggle = <span style="color: #cc66cc;">0</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">Dim</span> stra <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span> = hamount.<span style="color: #66cc66;">ToString</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;x = Convert.<span style="color: #66cc66;">ToInt32</span><span style="color: #66cc66;">(</span>stra.<span style="color: #66cc66;">Substring</span><span style="color: #66cc66;">(</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;Length = stra.<span style="color: #66cc66;">Length</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;stra = stra.<span style="color: #66cc66;">Substring</span><span style="color: #66cc66;">(</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;u = <span style="color: #cc66cc;">1</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">While</span> u <= Length * <span style="color: #cc66cc;">2</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stra = stra + x.<span style="color: #66cc66;">ToString</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;u = u + <span style="color: #cc66cc;">4</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">While</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">If</span> stra.<span style="color: #66cc66;">Length</span> <> Length <span style="color: #b1b100;">Then</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stra = stra.<span style="color: #66cc66;">Substring</span><span style="color: #66cc66;">(</span><span style="color: #cc66cc;">0</span>, Length<span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">Return</span> stra</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">&nbsp;<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Function</span></li></ol></div>
     
  2. expon

    expon Administrator
    Staff Member

    Joined:
    Oct 30, 2006
    Messages:
    1,393
    Likes Received:
    56
    Location:
    UK
    nice snippets skip :)

    just thought i'd post my VB.NET smart haggle function here.. maybe it's slightly easier to understand ;)

    Code (vb.net):
    1. <div class="vbnet" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> SMARTHaggle<span style="color: #000000;">(</span><span style="color: #FF8000;">ByVal</span> cost <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        cost = <span style="color: #0600FF;">Replace</span><span style="color: #000000;">(</span>cost, <span style="color: #808080;">","</span>, <span style="color: #808080;">""</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">Dim</span> strCost <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = cost</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">If</span> strCost.<span style="color: #0000FF;">Length</span> = <span style="color: #FF0000;">3</span> <span style="color: #FF8000;">Then</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> firstChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> mainChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> smartCost <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = firstChar & mainChar & mainChar</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return smartCost</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        ElseIf strCost.<span style="color: #0000FF;">Length</span> = <span style="color: #FF0000;">4</span> <span style="color: #FF8000;">Then</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> mainChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> firstChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> smartCost <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = firstChar & mainChar & mainChar & mainChar</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return smartCost</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        ElseIf strCost.<span style="color: #0000FF;">Length</span> = <span style="color: #FF0000;">5</span> <span style="color: #FF8000;">Then</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> firstChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> secondChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> mainChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">2</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> smartCost <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = firstChar & mainChar & mainChar & mainChar & mainChar</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return smartCost</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        ElseIf strCost.<span style="color: #0000FF;">Length</span> = <span style="color: #FF0000;">6</span> <span style="color: #FF8000;">Then</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> firstChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> secondChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> mainChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">2</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> smartCost <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = firstChar & secondChar & mainChar & mainChar & mainChar & mainChar</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return smartCost</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        ElseIf strCost.<span style="color: #0000FF;">Length</span> = <span style="color: #FF0000;">7</span> <span style="color: #FF8000;">Then</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> firstChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">0</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> secondChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">1</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> mainChar <span style="color: #FF8000;">As</span> Char = strCost.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">(</span><span style="color: #FF0000;">2</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">Dim</span> smartCost <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = firstChar & secondChar & mainChar & mainChar & mainChar & mainChar & mainChar</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return smartCost</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #FF8000;">Else</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            Return cost</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li></ol></div>
    btw for VB.NET use code=vbnet instead of code=vb
     
  3. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    With the bbcode in the admin cp there is the bbcode help line. Could you have it also say what the suported languages are.