If post has non-shortcode string

That’s indeed a basic PHP question. Use strpos(). Example:

if ( false !== strpos( $post->post_content, 'foo' ) ) {
    wp_enqueue_script();
}

Ps. I suggest you to not hook into wp_enqueue_scripts() but a later hooks, e.g. the_content and then load the JavaScript in the footer. This works best under all circumstances as wp_enqueue_scripts and wp_head are called way earlier before the post content is loaded/displayed.

See How to add stylesheets only to pages with specific shortcode? for an explanation on this as this question here is basically a duplicate.

error code: 523