Question

4
Replies
319
Views
PremalathaN7222 Member since 2018 6 posts
Cognizant Technology Solutions India Pvt Ltd
Posted: 1 year ago
Last activity: 1 year 7 months ago
Closed
Solved

How to get count of word occurrence in a file

Hi,

I would like to know is there any OOTB functions available to get the count of a specific word occurred in a string file. For Instance, In Pega i am reading below xml file as a string and i need to know how many times does "</Address>" tag present in that string. It would be great if someone helps me out. Thanks in advance

<PurchaseOrders><PurchaseOrderPurchaseOrderNumber="99503"OrderDate="1999-10-20"><AddressType="Shipping"><Name>Ellen Adams</Name><Street>123 Maple Street</Street><City>Mill Valley</City><State>CA</State><Zip>10999</Zip><Country>USA</Country></Address><AddressType="Billing"><Name>Tai Yee</Name><Street>8 Oak Avenue</Street><City>Old Town</City><State>PA</State><Zip>95819</Zip><Country>USA</Country></Address><DeliveryNotes>Please leave packages in shed by driveway.</DeliveryNotes><Items><ItemPartNumber="872-AA"><ProductName>Lawnmower</ProductName><Quantity>1</Quantity><USPrice>148.95</USPrice><Comment>Confirm this is electric</Comment></Item><ItemPartNumber="926-AA"><ProductName>Baby Monitor</ProductName><Quantity>2</Quantity><USPrice>39.98</USPrice><ShipDate>1999-05-21</ShipDate></Item></Items></PurchaseOrder><PurchaseOrderPurchaseOrderNumber="99505"OrderDate="1999-10-22"><AddressType="Shipping"><Name>Cristian Osorio</Name><Street>456 Main Street</Street><City>Buffalo</City><State>NY</State><Zip>98112</Zip><Country>USA</Country></Address><AddressType="Billing"><Name>Cristian Osorio</Name><Street>456 Main Street</Street><City>Buffalo</City><State>NY</State><Zip>98112</Zip><Country>USA</Country></Address><DeliveryNotes>Please notify me before shipping.</DeliveryNotes><Items><ItemPartNumber="456-NM"><ProductName>Power Supply</ProductName><Quantity>1</Quantity><USPrice>45.99</USPrice></Item></Items></PurchaseOrder><PurchaseOrderPurchaseOrderNumber="99504"OrderDate="1999-10-22"><AddressType="Shipping"><Name>Jessica Arnold</Name><Street>4055 Madison Ave</Street><City>Seattle</City><State>WA</State><Zip>98112</Zip><Country>USA</Country></Address><AddressType="Billing"><Name>Jessica Arnold</Name><Street>4055 Madison Ave</Street><City>Buffalo</City><State>NY</State><Zip>98112</Zip><Country>USA</Country></Address><Items><ItemPartNumber="898-AZ"><ProductName>Computer Keyboard</ProductName><Quantity>1</Quantity><USPrice>29.99</USPrice></Item><ItemPartNumber="898-AM"><ProductName>Wireless Mouse</ProductName><Quantity>1</Quantity><USPrice>14.99</USPrice></Item></Items></PurchaseOrder></PurchaseOrders>

Thanks & REgards,

Premalatha

Low-Code App Development
Moderation Team has archived post
Share this page LinkedIn