Page 1 of 1

Converting String to Numbers

Posted: Wed Apr 08, 2009 4:01 am
by amitkhosla
I have a requirement where we ask the user to enter the time before which he want the alert. He can say time like "15 minutes" for which i have written the below mentioned grammer. But this takes the input as "fifteen minutes". Now fifteen i want as 15. Is there any way by which i can get 15 in numerals.

Else is thr a way to convert covert fifteen to 15? I'll be very thankful to you.

<field name="reminderTime">
<prompt>
Please say the time before which we should alert you for the appointment.
For Example, for 15 minutes, say 15 minutes. For 1 week, say 1 week.
</prompt>
<grammar root="main" type="application/srgs+xml" mode="voice">
<rule id="main" scope="public">
<ruleref uri="builtin:grammar/number?minallowed=1;maxallowed=100;maxdecimal=0"/>
<item>
<one-of>
<item>day</item>
<item>days</item>
<item>week</item>
<item>weeks</item>
<item>month</item>
<item>months</item>
<item>hour</item>
<item>hours</item>
<item>minute</item>
<item>minutes</item>
</one-of>
</item>
</rule>
</grammar>
<filled>

</filled>
</field>