Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Remove everything from the beginning of text after the second occurrence of a matched string
Topic Summary: String manipulation
Created On: 01/09/2018 03:12 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 01/09/2018 03:12 PM
User is offline View Users Profile Print this message

Author Icon
MichaelOcampo
n00b (>6 posts)

Posts: 2
Joined: 01/09/2018

Hello all,

I've been working on a cheat sheet for different string manipulation methods, but seem to run into issues when trying to specify the occurrence of a matched sting in the event that I wan't to remove everything from beginning of text to a specific point and ignore the first occurrence of the matched string via the Instr function.

In this example I'm using a basic function "Instr(S1,S2)" to my recollection Instr function can be used to also specify position and occurrence, but when I try do this I get a type mismatch error. Perhaps I'm not doing something correctly, please see my example below. I realize there are multiple ways to do this, but would really like to know if there's a supported way to specify position and occurrence.

Desired result of my sample workflow below: Data\File.txt

examples:
The following example searches the string "Corporate Floor", beginning with the third character, for the string "or". It returns the position in "Corporate Floor" at which the second occurrence of "or" begins.

SHOW INSTR('Corporate Floor','or', 3, 2)
14


 Category Survey
AutoMate 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


Edited: 01/11/2018 at 02:18 PM by MichaelOcampo
 01/10/2018 08:41 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Michael,

As far as I know, there is no occurrence setting for the VB instr() function. You might be referring to the Oracle version of instr() but the VB version does not have occurrence.

I updated the task below to use instrrev() which grabs "test" from right to left instead of instr() which grabs "test" from left to right. Let me know if this will work for you.

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 01/11/2018 02:11 PM
User is offline View Users Profile Print this message

Author Icon
MichaelOcampo
n00b (>6 posts)

Posts: 2
Joined: 01/09/2018

Thank you! Worked like a charm. That ended up being a viable solution for what I need.

 Category Survey
AutoMate 8 version:
Windows version:
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1209 guests browsing this forum, which makes a total of 1209 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog