Jump to content

Remove words up to a certain number of words


Recommended Posts

@Tony007

If you need to split those strings in different ones, then you can use StringSplit() with the comma set as separator, which will return an array of eight (seven, if the parameter $STR_NOCOUNT is set), in which each element represents a day of the week.

From there, you can do whatever you want with that array :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

ok what FrancescoDiMuro sayd, or, using another way, you could also combine togheter StringLeft and StringInString so that StringInString can find the position of the fifth comma and keep all chars on the left up to that position less 1

#include <MsgBoxConstants.au3>

$sList = "Mon,Tues,Wed,Thur,Fri,Sat,Sun"

$iWords = 5 ; words to keep on the left

Local $sString = StringLeft($sList, StringInStr($sList & ',', ',', 1, $iWords) - 1)
MsgBox($MB_SYSTEMMODAL, "", "The " & $iWords & " leftmost words are: " & $sString)

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Also consider that since you know what you want, you can just ignore the other stuff altogether

#include<array.au3>

local $aList[] = ["Mon","Tues","Wed","Thur","Fri","Sat","Sun"]

_ArrayDisplay($aList , "The first 5 items" , 4)

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...