Ana sayfa Genel Swift – Bir değerin array’de olup olmadığını kontrol etme

Swift – Bir değerin array’de olup olmadığını kontrol etme

3385
275
PAYLAŞ

Merhabalar,

Bu dersimizde basitçe bir array’in içinde herhangi bir elemanın olup olmadığını kontrol etmeyi göreceğiz.

Önce aşağıdaki kod bloğunu playground’a yazıp gelen çıktıları inceleyelim.

Öncelikle sebzeler adında Stringlerden oluşan bir array oluşturuyoruz. Sonrasında “.contains()” metoduyla, o array’in belirttiğimiz Stringe sahip olup olmadığını kontrol edebiliyoruz.

Birinci if-else bloğumuzda, arrayimiz içerisinde Domates stringini barındırdığı için çıktı olarak “Buyrun, bir adet domates :P” yazısını görebiliyoruz.

Ancak ikinci if-else bloğumuzda, arrayimizde Ispanak stringi olmadığı için, .contains metodu false oluyor ve else durumuna düşerek, “Üzgünüz ıspanak yok :(” çıktısını alıyoruz.

Gördüğünüz gibi .contains() metodunu kullanarak, kolayca arraylerimizde bir objenin olup olmadığını kontrol edebiliyoruz.

PAYLAŞ
Önceki makaleUdemyde 1 Yıl!
Sonraki makaleSymPy ile Calculus hesaplamaları – Bölüm 3 (Seri açılımları)
Kadir Has Universitesi Elektrik&Elektronik Bölümünden 2016 yılında mezun oldum, mezuniyet sonrası alan değiştirerek bilgisayar bilimi ve programlama üzerine çalışmalarıma başladım. Amacım kendimi geliştirirken bir yandanda, programlama alanındaki türkçe kaynak azlığını giderebilmek için bloglar yazmak.

275 YORUMLAR

  1. You could certainly see your skills in the work you write. The sector hopes for more passionate writers like you who aren’t afraid to mention how they believe. At all times go after your heart.

  2. I do not even know how I ended up here, but I thought this post was good. I don’t know who you are but certainly you’re going to a famous blogger if you aren’t already 😉 Cheers!

  3. I have recently started a blog, the information you provide on this website has helped me greatly. Thank you for all of your time & work.

  4. Good day! I simply want to give an enormous thumbs up for the great information you have right here on this post. I will likely be coming back to your blog for extra soon.

  5. Hi, i think that i saw you visited my weblog thus i came to “return the favor”.I am attempting to find things to improve my website!I suppose its ok to use a few of your ideas!!

  6. Hey, you used to write fantastic, but the last several posts have been kinda boringK I miss your super writings. Past few posts are just a little out of track! come on!

  7. Hello, Neat post. There’s an issue together with your web site in internet explorer, might test thisK IE nonetheless is the market chief and a huge component to folks will leave out your wonderful writing because of this problem.

  8. I’ll immediately grab your rss as I can’t find your e-mail subscription link or newsletter service. Do you’ve any? Please let me know in order that I could subscribe. Thanks.

  9. I beloved as much as you will obtain performed right here. The cartoon is tasteful, your authored material stylish. however, you command get bought an edginess over that you want be handing over the following. in poor health indubitably come further formerly once more since precisely the same just about a lot often inside of case you shield this increase.

  10. It’s in point of fact a great and helpful piece of information. I am glad that you simply shared this useful information with us. Please stay us informed like this. Thanks for sharing.

  11. Needed to write you one little remark to finally thank you once again just for the magnificent suggestions you have shown on this site. It is quite generous of you to make easily all most of us might have made available as an ebook in making some profit on their own, particularly considering that you could have done it in the event you wanted. These concepts additionally served like the easy way to fully grasp that other individuals have similar fervor just as my own to realize lots more in regard to this condition. I am certain there are thousands of more fun opportunities ahead for many who find out your blog post.

  12. you are really a good webmaster. The site loading speed is incredible. It seems that you are doing any unique trick. Furthermore, The contents are masterpiece. you have done a magnificent job on this topic!

  13. Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!

  14. hey there and thank you for your information – I have certainly picked up anything new from right here.
    I did however expertise some technical points using this website, since I experienced to reload
    the site lots of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK? Not that I’m complaining, but slow loading instances times will often affect your placement in google and could damage your high quality score if ads and
    marketing with Adwords. Well I am adding this RSS to my e-mail and could
    look out for a lot more of your respective exciting content.
    Make sure you update this again soon.

  15. A person essentially lend a hand to make severely posts I’d state. That is the very first time I frequented your website page and thus far? I surprised with the research you made to make this particular put up amazing. Fantastic task!

  16. Hi, I think your site might be having browser compatibility issues. When I look at your website in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!

  17. CO2激光(CO2 laser / 二氧化碳激光)的波長是10600nm,照射到皮膚上會被皮膚的水份吸收,瞬間將皮膚有問題的組織氣化。CO2激光可以用來消除各種皮膚問題包括疣、癦、痣、脂溢性角化、粉刺和汗管瘤等。當治療後,您的皮膚需要5至10天時間復原。期間保持傷口清潔便可。優點:CO2激光所切割的深度比刮除術較深,亦較精準。可以處理較深層的皮膚問題,例如去除癦、油脂粒、肉粒、疣、珍珠疣、角質增生等。其復原亦較快,減少留下疤痕的機會。它最大的優點在於,能夠進一步減少激光治療過程當中的熱損傷反應,提升了激光治療的安全性,治療過程中幾乎沒有疼痛感

  18. Admiring the dedication you put into your site and in depth information you present. It’s good to come across a blog every once in a while that isn’t the same outdated rehashed information. Wonderful read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  19. Thank you for the auspicious writeup. It in fact was once a entertainment account it. Look complex to far delivered agreeable from you! By the way, how could we keep up a correspondence?

  20. I am really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it’s rare to see a great blog like this one these days..

  21. Undeniably believe that which you stated. Your favourite reason appeared to be on the internet the simplest thing to remember of. I say to you, I certainly get annoyed at the same time as folks consider worries that they just don’t understand about. You managed to hit the nail upon the highest and defined out the whole thing with no need side effect , people could take a signal. Will likely be again to get more. Thank you

  22. Right here is the right site for anyone who hopes to understand this topic.
    You know so much its almost hard to argue with you (not that I personally would want to…HaHa).
    You certainly put a new spin on a topic that’s been discussed for decades.
    Wonderful stuff, just wonderful!

  23. Great items from you, man. I’ve be mindful your stuff previous to and you are simply extremely magnificent. I really like what you have got here, certainly like what you are saying and the way wherein you are saying it. You’re making it enjoyable and you continue to take care of to keep it smart. I can not wait to learn far more from you. This is really a tremendous site.

  24. Hiya, I’m really glad I’ve found this information. Nowadays bloggers publish just about gossips and web and this is really irritating. A good blog with exciting content, that is what I need. Thank you for keeping this web site, I’ll be visiting it. Do you do newsletters? Cant find it.

  25. I happen to be writing to let you be aware of of the nice discovery my wife’s girl went through reading through your blog. She figured out a wide variety of pieces, not to mention how it is like to possess a wonderful coaching mood to make certain people with ease know precisely chosen advanced subject matter. You truly exceeded visitors’ expectations. I appreciate you for displaying the effective, trusted, educational as well as cool thoughts on this topic to Janet.

  26. I am really enjoying the theme/design of your web site. Do you ever run into any web browser compatibility issues? A handful of my blog audience have complained about my blog not operating correctly in Explorer but looks great in Opera. Do you have any solutions to help fix this problem?

  27. I precisely needed to thank you so much again. I am not sure what I would’ve done without those thoughts shown by you about such a concern. It had been a intimidating circumstance in my circumstances, but observing a new professional avenue you treated that took me to weep for fulfillment. Now i’m thankful for this guidance and trust you know what a great job that you’re accomplishing teaching many others thru your websites. Most likely you have never got to know all of us.

  28. Thanks for every other excellent article. Where else may just anybody get that kind of information in such a perfect manner of writing? I’ve a presentation subsequent week, and I am at the look for such info.

  29. I’m impressed, I need to say. Actually hardly ever do I encounter a blog that’s each educative and entertaining, and let me let you know, you have hit the nail on the head. Your concept is outstanding; the problem is one thing that not enough individuals are speaking intelligently about. I’m very happy that I stumbled throughout this in my seek for something relating to this.

  30. Great goods from you, man. I have understand your stuff previous to and you are just too great. I really like what you have acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still take care of to keep it wise. I can not wait to read far more from you. This is really a wonderful site.

  31. Howdy very cool website!! Man .. Excellent .. Wonderful .. I will bookmark your blog and take the feeds additionally?KI am glad to find so many helpful information right here within the submit, we’d like develop more strategies on this regard, thank you for sharing. . . . . .

  32. I am very happy to read this. This is the type of manual that needs to be given and not the accidental misinformation that’s at the other blogs. Appreciate your sharing this best doc.

  33. I wanted to draft you this little remark in order to say thanks yet again on the magnificent strategies you have documented here. It has been certainly tremendously open-handed of you to offer unhampered exactly what a lot of people could possibly have supplied for an e-book in order to make some profit for themselves, specifically seeing that you could possibly have done it if you ever considered necessary. The points as well served like the great way to be aware that most people have similar dreams like my own to figure out way more with respect to this matter. I think there are numerous more enjoyable opportunities up front for folks who browse through your blog post.

  34. I would like to thank you for the efforts you’ve put in writing this website. I’m hoping the same high-grade blog post from you in the upcoming as well. Actually your creative writing skills has inspired me to get my own web site now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.

  35. Thank you for every other informative blog. Where else may just I get that kind of information written in such an ideal manner? I have a challenge that I’m simply now operating on, and I have been on the glance out for such information.

  36. Hello are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any html coding knowledge to make your own blog? Any help would be really appreciated!

  37. I loved as much as you’ll receive carried out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get bought an nervousness over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.

  38. Good day! This is my first comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading through your posts. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thanks for your time!

  39. An intriguing discussion is definitely worth comment. There’s no doubt that that you need to publish more on this subject matter, it may not be a taboo matter but typically people do not talk about these topics. To the next! All the best!!|

  40. You actually make it seem really easy along with your presentation but I to find this matter to be really one thing which I think I might never understand. It seems too complicated and very vast for me. I am taking a look ahead in your subsequent put up, I¦ll try to get the hold of it!

  41. Thank you for sharing excellent informations. Your web-site is so cool. I am impressed by the details that you¦ve on this site. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for more articles. You, my pal, ROCK! I found simply the info I already searched everywhere and just couldn’t come across. What a great website.

  42. Throughout this awesome design of things you actually get an A just for effort and hard work. Exactly where you lost us was first in all the facts. You know, they say, the devil is in the details… And that could not be much more true right here. Having said that, let me inform you what exactly did deliver the results. The writing can be quite convincing and that is most likely the reason why I am making an effort in order to opine. I do not make it a regular habit of doing that. Next, while I can easily notice a jumps in reason you make, I am not really confident of how you seem to connect your details which inturn produce the actual final result. For now I will, no doubt yield to your issue however hope in the future you actually connect your dots better.

  43. Thanks for sharing excellent informations. Your web-site is so cool. I’m impressed by the details that you’ve on this site. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found just the info I already searched everywhere and simply could not come across. What a great website.

  44. Thanks for all of the hard work on this blog. My mother takes pleasure in working on investigation and it’s really simple to grasp why. We all learn all of the dynamic manner you offer very useful steps via your blog and as well as inspire contribution from other ones on this concept while our favorite girl is always understanding a lot. Enjoy the rest of the year. You are always performing a fantastic job.

  45. There are actually loads of particulars like that to take into consideration. That could be a nice point to convey up. I offer the ideas above as basic inspiration but clearly there are questions just like the one you convey up the place a very powerful factor will likely be working in honest good faith. I don?t know if best practices have emerged round issues like that, however I’m positive that your job is clearly identified as a fair game. Each girls and boys feel the impression of only a second’s pleasure, for the remainder of their lives.

  46. I absolutely love your blog and find nearly all of your post’s to be exactly I’m looking for. Do you offer guest writers to write content for yourself? I wouldn’t mind composing a post or elaborating on most of the subjects you write concerning here. Again, awesome blog!

  47. I am really impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one these days..

  48. you’re truly a good webmaster. The site loading pace is incredible. It sort of feels that you are doing any unique trick. In addition, The contents are masterwork. you have done a excellent task on this topic!

  49. I’ve been browsing on-line more than three hours as of late, yet I never found any fascinating article like yours. It’s lovely value enough for me. In my opinion, if all web owners and bloggers made excellent content material as you probably did, the internet will be a lot more useful than ever before.

  50. Hello are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding knowledge to make your own blog? Any help would be really appreciated!

  51. I haven¦t checked in here for some time since I thought it was getting boring, but the last several posts are good quality so I guess I¦ll add you back to my daily bloglist. You deserve it my friend 🙂

  52. You really make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complicated and very broad for me. I’m looking forward for your next post, I’ll try to get the hang of it!

  53. I’d have to test with you here. Which isn’t something I normally do! I enjoy reading a submit that may make folks think. Also, thanks for permitting me to remark!

  54. We’re a gaggle of volunteers and opening a brand new scheme in our community. Your site offered us with helpful info to paintings on. You have performed a formidable process and our entire community can be grateful to you.

  55. Great beat ! I wish to apprentice while you amend your site, how could i subscribe for a blog website? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept

  56. Spot on with this write-up, I really think this web site needs much more consideration. I’ll in all probability be again to read far more, thanks for that info.

  57. Whats up! I simply wish to give an enormous thumbs up for the great information you could have here on this post. I can be coming back to your weblog for extra soon.

  58. Terrific work! This is the type of information that should be shared around the internet. Shame on the search engines for not positioning this post higher! Come on over and visit my web site . Thanks =)

  59. After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

  60. Thank you for sharing excellent informations. Your web-site is very cool. I am impressed by the details that you have on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched all over the place and just couldn’t come across. What an ideal site.

  61. I know this if off topic but I’m looking into starting my own blog and was curious what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet smart so I’m not 100 certain. Any tips or advice would be greatly appreciated. Kudos

  62. I haven’t checked in here for some time since I thought it was getting boring, but the last few posts are good quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂

  63. I am now not certain where you’re getting your information, but good topic. I needs to spend a while finding out much more or understanding more. Thank you for fantastic info I used to be in search of this information for my mission.

  64. I like what you guys are up too. Such intelligent work and reporting! Carry on the excellent works guys I’ve incorporated you guys to my blogroll. I think it will improve the value of my website :).

  65. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but other than that, this is great blog. An excellent read. I’ll certainly be back.

  66. Thanks for another informative site. Where else could I get that kind of information written in such an ideal way? I have a project that I’m just now working on, and I’ve been on the look out for such information.

  67. Woah! I’m really digging the template/theme of this website. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this. In addition, the blog loads very fast for me on Safari. Exceptional Blog!

  68. Hiya, I am really glad I’ve found this info. Nowadays bloggers publish only about gossips and web and this is really frustrating. A good website with exciting content, that is what I need. Thanks for keeping this web site, I will be visiting it. Do you do newsletters? Can not find it.

  69. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  70. obviously like your website but you need to check the spelling on quite a few of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the truth nevertheless I will certainly come back again.

  71. I’m impressed, I need to say. Actually hardly ever do I encounter a weblog that’s each educative and entertaining, and let me inform you, you’ve gotten hit the nail on the head. Your idea is excellent; the difficulty is something that not enough people are speaking intelligently about. I’m very glad that I stumbled across this in my search for one thing regarding this.

  72. Great items from you, man. I’ve be aware your stuff prior to and you are just too fantastic. I actually like what you have acquired here, really like what you are saying and the way wherein you assert it. You’re making it entertaining and you still care for to keep it smart. I cant wait to learn much more from you. This is really a wonderful web site.

  73. My coder 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 various websites for about a year and am nervous about switching to another platform. I have heard fantastic things about blogengine.net. Is there a way I can transfer all my wordpress posts into it? Any help would be greatly appreciated!

  74. I think this is among the most important information for me. And i’m glad reading your article. But wanna remark on few general things, The web site style is wonderful, the articles is really excellent : D. Good job, cheers

  75. Hey there just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Opera. I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you know. The style and design look great though! Hope you get the issue fixed soon. Thanks

  76. Magnificent beat ! I would like to apprentice whilst you amend your web site, how could i subscribe for a weblog website? The account helped me a appropriate deal. I have been tiny bit acquainted of this your broadcast provided vibrant transparent concept

  77. I’ve been browsing online greater than 3 hours lately, yet I never found any fascinating article like yours. It?¦s beautiful price enough for me. Personally, if all webmasters and bloggers made just right content as you did, the web can be much more helpful than ever before.

  78. An individual basically help to make fundamentally posts I’d state. That is the absolute first time I frequented your website page and up to now? I shocked with the investigation you made to influence this real to distribute mind blowing.

  79. A formidable share, I simply given this onto a colleague who was doing just a little analysis on this. And he in truth bought me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I really feel strongly about it and love reading more on this topic. If potential, as you become expertise, would you thoughts updating your weblog with extra particulars? It’s highly helpful for me. Big thumb up for this blog put up!

  80. With havin so much content do you ever run into any issues of plagorism or copyright violation? My blog has a lot of unique content I’ve either created myself or outsourced but it looks like a lot of it is popping it up all over the internet without my authorization. Do you know any techniques to help protect against content from being ripped off? I’d really appreciate it.

  81. El servicio técnico del taller me da el presupuesto que una vez pagado por mi, llevo personalmente a las oficinas de Domestic & General, el recibimiento fue peor de lo que me podría imaginar, nada mas entrar notas que ahí no puedes estar, que tienes que llamar a su fabuloso para ser atendido, pero como insistí me cogieron la documentación. Compré una Sony Bravia de 2 p en el 2009 y la aseguré un par de años más con esta compañia ya que el Saturn lo vendía muy bien y los ponía por las nubes.

BİR CEVAP BIRAK

Please enter your comment!
Please enter your name here