Замена подстроки в строке в Asterisk

В данной заметке я приведу пример макроса, который меняет подстроку в строке в Asterisk. Собственно сам макрос:

[macro-replace]
;
; ${ARG1} - String source
; ${ARG2} - Chars to replace
; ${ARG3} - Chars to replace with
;
exten => s,1,NoOp(Replacing ${ARG2} for ${ARG3} in ${ARG1})
exten => s,n,Set(str=${ARG1})
exten => s,n,Set(find=${ARG2})
exten => s,n,Set(replace=${ARG3})
exten => s,n,Set(i=0)
exten => s,n,Set(length=${LEN(${str})})
exten => s,n,While($[${i} < ${length}])
exten => s,n,GotoIf($["${str:${i}:1}" != "${find}"]?continue)
exten => s,n,Set(pre=)
exten => s,n,GotoIf($["${i}" = "0"]?post)
exten => s,n,Set(pre=${str:0:${i}})
exten => s,n(post),Set(post=)
exten => s,n,GotoIf($["${i}" = $[${length} - 1]]?write)
exten => s,n,Set(post=${str:$[${i} + 1]})
exten => s,n(write),Set(str=${pre}${replace}${post})
exten => s,n(continue),Set(i=$[${i} + 1])
exten => s,n,EndWhile
exten => s,n,Set(REPLACERESULT=${str})

195 комментариев к “Замена подстроки в строке в Asterisk

  1. Aw, this was a truly wonderful blog post. In idea I would love to place in creating such as this in addition? taking time as well as real initiative to make a great post? but what can I state? I postpone alot as well as by no means seem to get something done.

  2. I seriously love your site.. Very nice colors & theme. Did you create this web site yourself? Please reply back as I’m trying to create my own personal website and would love to know where you got this from or just what the theme is named. Many thanks!

  3. There are definitely a great deal of details like that to take into consideration. That is a fantastic point to bring up. I provide the ideas above as general motivation however clearly there are questions like the one you raise where the most important thing will certainly be working in sincere good faith. I don?t understand if finest techniques have arised around things like that, however I make sure that your job is clearly identified as a level playing field. Both young boys and ladies really feel the effect of simply a moment?s pleasure, for the remainder of their lives.

  4. There are some fascinating points in time in this post but I don?t know if I see every one of them center to heart. There is some legitimacy however I will take hold opinion till I consider it even more. Great write-up, thanks as well as we want more! Added to FeedBurner too

  5. Good day! This is my 1st comment here so I just wanted to give a quick
    shout out and say I really enjoy reading your articles.
    Can you recommend any other blogs/websites/forums that
    go over the same subjects? Thanks!

  6. Hi! Someone in my Myspace group shared this site with us so I
    came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers!
    Outstanding blog and superb design and style.

  7. After research study a few of the blog posts on your site now, and also I really like your means of blog writing. I bookmarked it to my book mark site list and will certainly be checking back soon. Pls look into my website too as well as let me understand what you assume.

  8. When I initially commented I clicked the -Inform me when new remarks are added- checkbox and currently each time a remark is added I get four e-mails with the very same remark. Exists any way you can remove me from that service? Thanks!

  9. Youre so awesome! I do not mean Ive review anything similar to this before. So nice to locate someone with some initial ideas on this subject. realy thanks for beginning this up. this internet site is something that is needed on the internet, a person with a little creativity. helpful task for bringing something new to the net!

  10. I’m impressed, I have to admit. Truly rarely should i encounter a blog that’s both educative and entertaining, and let me tell you, you might have hit the nail for the head. Your notion is outstanding; ab muscles something which there are not enough persons are speaking intelligently about. I’m very happy we stumbled across this around my try to find something regarding this.

  11. There are some interesting moments in this post however I don?t recognize if I see all of them center to heart. There is some credibility however I will certainly take hold opinion until I look into it better. Great article, many thanks as well as we want more! Contributed to FeedBurner too

  12. This is the ideal blog for any individual who wishes to discover this topic. You recognize so much its virtually hard to argue with you (not that I in fact would want?HaHa). You most definitely put a new spin on a subject thats been covered for several years. Wonderful things, just wonderful!

  13. Can I simply state what a relief to locate somebody that actually recognizes what theyre speaking about online. You absolutely know exactly how to bring a concern to light as well as make it essential. Even more individuals require to read this and recognize this side of the story. I cant believe youre not much more preferred due to the fact that you certainly have the present.

  14. I just want to tell you that I am just beginner to weblog and actually enjoyed this web-site. Almost certainly I’m likely to bookmark your blog . You surely come with perfect articles and reviews. Kudos for sharing with us your website page.

  15. I simply want to say I am beginner to weblog and honestly loved you’re page. Very likely I’m likely to bookmark your blog . You actually have impressive well written articles. Thanks a lot for sharing with us your webpage.

  16. I’m really enjoying the design and layout of your website. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!

  17. Thanks for ones marvelous posting! I truly enjoyed reading it, you
    are a great author. I will make certain to bookmark your blog and will eventually
    come back later in life. I want to encourage you to continue your great work,
    have a nice holiday weekend!

  18. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty value enough for me. In my opinion, if all site owners and bloggers made excellent content as you did, the internet will be a lot more useful than ever before.

  19. Can I just say what a aid to find somebody who really knows what theyre talking about on the internet. You definitely know find out how to convey an issue to mild and make it important. Extra people have to learn this and perceive this aspect of the story. I cant consider youre not more widespread because you undoubtedly have the gift.

  20. I just want to tell you that I am just all new to blogs and definitely savored you’re web site. Probably I’m want to bookmark your site . You certainly come with very good posts. Regards for sharing your blog.

  21. Does your site have a contact page? I’m having trouble locating it but, I’d like to shoot you an email. I’ve got some suggestions for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it improve over time.

  22. You can definitely see your skills within the paintings you write. The arena hopes for more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart. “What power has law where only money rules.” by Gaius Petronius.

  23. Greetings I am so delighted I found your web site, I really found you by error, while I was browsing on Bing for something else, Anyways I am here now and would just like to say thank you for a incredible post and a all round thrilling blog (I also love the theme/design), I don’t have time to read it all at the moment but I have saved it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome work.

  24. Hello there! I could have sworn I’ve been to this site before but after looking at many of the posts I realized it’s new to me. Anyhow, I’m certainly happy I came across it and I’ll be book-marking it and checking back often.

  25. Hi there! This post could not be written much better! Looking at this post reminds me of my previous roommate! He constantly kept preaching about this. I am going to forward this information to him. Fairly certain he’ll have a great read. I appreciate you for sharing!

  26. May I just say what a relief to find an individual who really understands what they’re talking about over the internet. You actually know how to bring a problem to light and make it important. More and more people need to read this and understand this side of your story. It’s surprising you aren’t more popular because you certainly have the gift.

  27. My programmer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the costs. But he’s tryiong none the less. I’ve been using WordPress on numerous websites for about a year and am anxious about switching to another platform. I have heard good things about blogengine.net. Is there a way I can transfer all my wordpress content into it? Any kind of help would be really appreciated!

  28. Thanks for helping me to attain new ideas about pcs. I also have belief that certain of the best ways to keep your notebook in prime condition is by using a hard plastic case, as well as shell, that matches over the top of the computer. A majority of these protective gear usually are model distinct since they are manufactured to fit perfectly on the natural covering. You can buy these directly from the seller, or via third party sources if they are available for your laptop, however only a few laptop may have a shell on the market. Once more, thanks for your recommendations.

  29. hey there and thank you for your info – I have definitely picked up something new from right here. I did however expertise several technical points using this web site, as I experienced to reload the website lots of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances times will sometimes affect your placement in google and could damage your high quality score if advertising and marketing with Adwords. Well I’m adding this RSS to my e-mail and can look out for a lot more of your respective fascinating content. Make sure you update this again very soon..

  30. Hello there, There’s no doubt that your blog might be having web browser compatibility issues. When I take a look at your blog in Safari, it looks fine however, if opening in Internet Explorer, it has some overlapping issues. I simply wanted to provide you with a quick heads up! Aside from that, wonderful blog!

  31. Howdy, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you reduce it, any plugin or anything you can advise? I get so much lately it’s driving me mad so any support is very much appreciated.

  32. What i do not realize is in fact how you are no longer actually much more well-favored than you may be now. You’re so intelligent. You already know thus significantly on the subject of this topic, made me in my opinion believe it from a lot of varied angles. Its like men and women don’t seem to be interested unless it is something to do with Woman gaga! Your personal stuffs great. All the time maintain it up!

  33. Youre so cool! I dont suppose Ive read something like this before. So good to search out any person with some original thoughts on this subject. realy thanks for beginning this up. this web site is one thing that is needed on the net, somebody with slightly originality. helpful job for bringing something new to the web!

  34. Considerably, the post is in reality the finest on that laudable topic. I fit in with your conclusions and can eagerly look forward to your incoming updates. Saying thanks definitely will not simply just be enough, for the outstanding clarity in your writing. I will certainly at once grab your rss feed to stay privy of any kind of updates. Pleasant work and also much success in your business efforts!

  35. The very next time I read a blog, I hope that it won’t fail me as much as this particular one. After all, Yes, it was my choice to read through, but I actually believed you would have something interesting to talk about. All I hear is a bunch of whining about something you could possibly fix if you were not too busy searching for attention.

  36. Needed to draft you the tiny observation to finally thank you so much over again with your beautiful knowledge you have provided in this case. It’s strangely open-handed with you to present unreservedly all a few people could possibly have made available as an e-book to help with making some profit for themselves, mostly considering that you might have done it if you ever decided. These principles as well worked as the great way to fully grasp most people have the same passion the same as mine to find out somewhat more when considering this problem. I’m certain there are millions of more pleasurable moments up front for individuals who read your website.

  37. Your style is so unique compared to other folks I have read stuff from. Thanks for posting when you’ve got the opportunity, Guess I’ll just book mark this page.

  38. This is the right blog for anybody who hopes to understand this topic. You understand a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a topic that’s been discussed for decades. Excellent stuff, just wonderful.

  39. An outstanding share! I’ve just forwarded this onto a coworker who had been conducting a little research on this. And he actually ordered me dinner due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to discuss this topic here on your site.

  40. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your blog when you could be giving us something informative to read?

  41. That is very interesting, You are a very professional blogger. I’ve joined your rss feed and stay up for seeking extra of your wonderful post. Also, I’ve shared your web site in my social networks!

  42. Youre so cool! I dont suppose Ive learn anything like this before. So good to seek out any person with some unique ideas on this subject. realy thanks for starting this up. this website is something that’s needed on the net, someone with a bit of originality. useful job for bringing something new to the web!

  43. Hi there! This blog post could not be written any better! Going through this article reminds me of my previous roommate! He continually kept preaching about this. I’ll send this article to him. Fairly certain he will have a great read. I appreciate you for sharing!

  44. Along with every thing which seems to be developing inside this particular subject matter, many of your opinions are actually very radical. Even so, I appologize, but I can not subscribe to your whole theory, all be it refreshing none the less. It appears to everyone that your remarks are actually not completely justified and in actuality you are your self not even thoroughly certain of the point. In any event I did appreciate reading it.

  45. This is the perfect blog for anyone who would like to understand this topic. You realize a whole lot its almost hard to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a topic that has been discussed for decades. Excellent stuff, just great.

  46. Nearly all of whatever you say is supprisingly legitimate and it makes me wonder the reason why I hadn’t looked at this with this light previously. This piece truly did switch the light on for me personally as far as this specific subject goes. Nevertheless there is 1 issue I am not necessarily too comfortable with and whilst I make an effort to reconcile that with the central idea of your point, allow me observe just what the rest of your visitors have to point out.Well done.

  47. Can I simply just say what a relief to find someone that really knows what they are talking about over the internet. You definitely realize how to bring an issue to light and make it important. More people must look at this and understand this side of your story. I was surprised you’re not more popular since you most certainly possess the gift.

  48. This is the right webpage for anybody who wants to find out about this topic. You know a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a brand new spin on a subject that’s been written about for a long time. Great stuff, just great.

  49. Hiya! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My blog looks weird when viewing from my iphone4. I’m trying to find a theme or plugin that might be able to fix this problem. If you have any suggestions, please share. Many thanks!

  50. Hey just wanted to give you a quick heads up and let you know a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same results.

  51. An intriguing discussion is definitely worth comment. I do believe that you ought to write more about this topic, it may not be a taboo subject but generally folks don’t discuss such topics. To the next! Best wishes.

  52. An impressive share! I’ve just forwarded this onto a coworker who has been doing a little research on this. And he in fact bought me lunch because I found it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending the time to discuss this matter here on your site.

  53. Together with everything which appears to be building inside this subject matter, a significant percentage of perspectives happen to be somewhat exciting. Nevertheless, I beg your pardon, because I can not give credence to your whole plan, all be it radical none the less. It seems to me that your remarks are not completely rationalized and in actuality you are yourself not even fully convinced of your assertion. In any event I did appreciate examining it.

  54. I was very pleased to find this website. I want to to thank you for ones time just for this wonderful read!! I definitely liked every bit of it and I have you book-marked to check out new things in your website.

  55. You really make it appear so easy with your presentation however I in finding this matter to be really one thing which I think I’d by no means understand. It sort of feels too complicated and very huge for me. I am looking ahead in your subsequent put up, I will try to get the hang of it!

  56. Thanks for a marvelous posting! I genuinely enjoyed reading it, you can be a great author.I will remember to bookmark your blog and will eventually come back later in life. I want to encourage you to ultimately continue your great writing, have a nice evening!

  57. Hello would you mind letting me know which hosting company you’re working with? I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot faster then most. Can you suggest a good internet hosting provider at a reasonable price? Thank you, I appreciate it!

  58. Hmm is anyone else experiencing problems with the pictures on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.

  59. Hi I wish to to share a remark here concerning you to definitely have the ability to inform you just how much i personally Loved this particular study. I must run off in order to aTurkey Day Dinner but wanted to leave ya a simple comment. We preserved you So will be coming back subsequent function to read more of yer high quality posts. Continue the quality work.

  60. What i do not realize is actually how you’re not really much more well-liked than you might be now. You’re very intelligent. You realize therefore significantly relating to this subject, made me personally consider it from numerous varied angles. Its like women and men aren’t fascinated unless it is one thing to accomplish with Lady gaga! Your own stuffs outstanding. Always maintain it up!

Оставить ответ

Ваш адрес email не будет опубликован. Обязательные поля помечены *